clavix 4.10.0 → 4.11.2

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 (111) hide show
  1. package/dist/cli/commands/analyze.d.ts +3 -0
  2. package/dist/cli/commands/analyze.js +11 -5
  3. package/dist/cli/commands/execute.d.ts +2 -2
  4. package/dist/cli/commands/execute.js +23 -21
  5. package/dist/cli/commands/improve.d.ts +32 -0
  6. package/dist/cli/commands/improve.js +250 -0
  7. package/dist/cli/commands/init.js +35 -29
  8. package/dist/cli/commands/prd.js +14 -13
  9. package/dist/cli/commands/prompts/clear.d.ts +2 -2
  10. package/dist/cli/commands/prompts/clear.js +32 -26
  11. package/dist/cli/commands/prompts/list.js +14 -19
  12. package/dist/cli/commands/summarize.js +23 -14
  13. package/dist/cli/commands/verify.d.ts +2 -2
  14. package/dist/cli/commands/verify.js +26 -24
  15. package/dist/core/doc-injector.d.ts +2 -0
  16. package/dist/core/doc-injector.js +12 -13
  17. package/dist/core/intelligence/intent-detector.d.ts +4 -0
  18. package/dist/core/intelligence/intent-detector.js +8 -18
  19. package/dist/core/intelligence/pattern-library.d.ts +16 -10
  20. package/dist/core/intelligence/pattern-library.js +47 -35
  21. package/dist/core/intelligence/patterns/actionability-enhancer.d.ts +2 -2
  22. package/dist/core/intelligence/patterns/actionability-enhancer.js +1 -1
  23. package/dist/core/intelligence/patterns/alternative-phrasing-generator.d.ts +2 -2
  24. package/dist/core/intelligence/patterns/alternative-phrasing-generator.js +1 -1
  25. package/dist/core/intelligence/patterns/ambiguity-detector.d.ts +2 -2
  26. package/dist/core/intelligence/patterns/ambiguity-detector.js +1 -1
  27. package/dist/core/intelligence/patterns/assumption-explicitizer.d.ts +2 -2
  28. package/dist/core/intelligence/patterns/assumption-explicitizer.js +1 -1
  29. package/dist/core/intelligence/patterns/base-pattern.d.ts +10 -7
  30. package/dist/core/intelligence/patterns/base-pattern.js +7 -3
  31. package/dist/core/intelligence/patterns/completeness-validator.d.ts +2 -2
  32. package/dist/core/intelligence/patterns/completeness-validator.js +1 -1
  33. package/dist/core/intelligence/patterns/conciseness-filter.d.ts +2 -2
  34. package/dist/core/intelligence/patterns/conciseness-filter.js +1 -1
  35. package/dist/core/intelligence/patterns/context-precision.d.ts +2 -2
  36. package/dist/core/intelligence/patterns/context-precision.js +1 -1
  37. package/dist/core/intelligence/patterns/conversation-summarizer.d.ts +2 -2
  38. package/dist/core/intelligence/patterns/conversation-summarizer.js +1 -1
  39. package/dist/core/intelligence/patterns/dependency-identifier.d.ts +2 -2
  40. package/dist/core/intelligence/patterns/dependency-identifier.js +1 -1
  41. package/dist/core/intelligence/patterns/domain-context-enricher.d.ts +2 -2
  42. package/dist/core/intelligence/patterns/domain-context-enricher.js +1 -1
  43. package/dist/core/intelligence/patterns/edge-case-identifier.d.ts +2 -2
  44. package/dist/core/intelligence/patterns/edge-case-identifier.js +1 -1
  45. package/dist/core/intelligence/patterns/error-tolerance-enhancer.d.ts +2 -2
  46. package/dist/core/intelligence/patterns/error-tolerance-enhancer.js +1 -1
  47. package/dist/core/intelligence/patterns/implicit-requirement-extractor.d.ts +2 -2
  48. package/dist/core/intelligence/patterns/implicit-requirement-extractor.js +1 -1
  49. package/dist/core/intelligence/patterns/objective-clarifier.d.ts +2 -2
  50. package/dist/core/intelligence/patterns/objective-clarifier.js +1 -1
  51. package/dist/core/intelligence/patterns/output-format-enforcer.d.ts +2 -2
  52. package/dist/core/intelligence/patterns/output-format-enforcer.js +1 -1
  53. package/dist/core/intelligence/patterns/prd-structure-enforcer.d.ts +2 -2
  54. package/dist/core/intelligence/patterns/prd-structure-enforcer.js +1 -1
  55. package/dist/core/intelligence/patterns/prerequisite-identifier.d.ts +2 -2
  56. package/dist/core/intelligence/patterns/prerequisite-identifier.js +1 -1
  57. package/dist/core/intelligence/patterns/requirement-prioritizer.d.ts +2 -2
  58. package/dist/core/intelligence/patterns/requirement-prioritizer.js +1 -1
  59. package/dist/core/intelligence/patterns/scope-definer.d.ts +2 -2
  60. package/dist/core/intelligence/patterns/scope-definer.js +1 -1
  61. package/dist/core/intelligence/patterns/step-decomposer.d.ts +2 -2
  62. package/dist/core/intelligence/patterns/step-decomposer.js +1 -1
  63. package/dist/core/intelligence/patterns/structure-organizer.d.ts +2 -2
  64. package/dist/core/intelligence/patterns/structure-organizer.js +1 -1
  65. package/dist/core/intelligence/patterns/success-criteria-enforcer.d.ts +2 -2
  66. package/dist/core/intelligence/patterns/success-criteria-enforcer.js +1 -1
  67. package/dist/core/intelligence/patterns/success-metrics-enforcer.d.ts +2 -2
  68. package/dist/core/intelligence/patterns/success-metrics-enforcer.js +1 -1
  69. package/dist/core/intelligence/patterns/technical-context-enricher.d.ts +2 -2
  70. package/dist/core/intelligence/patterns/technical-context-enricher.js +1 -1
  71. package/dist/core/intelligence/patterns/topic-coherence-analyzer.d.ts +2 -2
  72. package/dist/core/intelligence/patterns/topic-coherence-analyzer.js +1 -1
  73. package/dist/core/intelligence/patterns/user-persona-enricher.d.ts +2 -2
  74. package/dist/core/intelligence/patterns/user-persona-enricher.js +1 -1
  75. package/dist/core/intelligence/patterns/validation-checklist-creator.d.ts +2 -2
  76. package/dist/core/intelligence/patterns/validation-checklist-creator.js +1 -1
  77. package/dist/core/intelligence/types.d.ts +6 -3
  78. package/dist/core/intelligence/universal-optimizer.d.ts +20 -15
  79. package/dist/core/intelligence/universal-optimizer.js +44 -29
  80. package/dist/core/prompt-manager.d.ts +24 -22
  81. package/dist/core/prompt-manager.js +65 -92
  82. package/dist/core/verification-manager.d.ts +8 -7
  83. package/dist/core/verification-manager.js +34 -41
  84. package/dist/templates/agents/octo.md +6 -8
  85. package/dist/templates/instructions/README.md +161 -188
  86. package/dist/templates/instructions/core/clavix-mode.md +3 -4
  87. package/dist/templates/instructions/core/verification.md +15 -17
  88. package/dist/templates/instructions/troubleshooting/jumped-to-implementation.md +1 -1
  89. package/dist/templates/instructions/troubleshooting/skipped-file-creation.md +7 -7
  90. package/dist/templates/slash-commands/_canonical/archive.md +1 -1
  91. package/dist/templates/slash-commands/_canonical/execute.md +39 -41
  92. package/dist/templates/slash-commands/_canonical/improve.md +604 -0
  93. package/dist/templates/slash-commands/_canonical/plan.md +1 -1
  94. package/dist/templates/slash-commands/_canonical/prd.md +2 -2
  95. package/dist/templates/slash-commands/_canonical/start.md +1 -1
  96. package/dist/templates/slash-commands/_canonical/summarize.md +1 -1
  97. package/dist/templates/slash-commands/_canonical/verify.md +9 -9
  98. package/dist/templates/slash-commands/_components/agent-protocols/decision-rules.md +16 -16
  99. package/dist/templates/slash-commands/_components/agent-protocols/self-correction.md +4 -4
  100. package/dist/templates/slash-commands/_components/agent-protocols/state-assertion.md +3 -4
  101. package/dist/templates/slash-commands/_components/agent-protocols/state-awareness.md +1 -1
  102. package/dist/templates/slash-commands/_components/sections/escalation-factors.md +25 -25
  103. package/dist/templates/slash-commands/_components/sections/pattern-visibility.md +27 -33
  104. package/dist/templates/slash-commands/_components/troubleshooting/mode-confusion.md +1 -1
  105. package/dist/templates/slash-commands/_components/troubleshooting/triage-escalation.md +9 -9
  106. package/dist/types/config.d.ts +1 -2
  107. package/dist/types/verification.d.ts +7 -6
  108. package/dist/types/verification.js +2 -1
  109. package/package.json +3 -1
  110. package/dist/templates/slash-commands/_canonical/deep.md +0 -651
  111. package/dist/templates/slash-commands/_canonical/fast.md +0 -535
@@ -1,651 +0,0 @@
1
- ---
2
- name: "Clavix: Deep"
3
- description: Comprehensive analysis with alternatives, edge cases, and validation
4
- ---
5
-
6
- # ⛔ STOP: OPTIMIZATION MODE - NOT IMPLEMENTATION
7
-
8
- **THIS IS A PROMPT ANALYSIS WORKFLOW. YOU MUST NOT IMPLEMENT ANYTHING.**
9
-
10
- ## Critical Understanding
11
-
12
- This template exists because agents (including you) tend to "help" by doing work immediately.
13
- **That's the wrong behavior here.** Your job is to ANALYZE and IMPROVE the prompt, then STOP.
14
-
15
- ## What "Implementation" Looks Like (ALL FORBIDDEN)
16
- - ❌ Reading project files to "understand context" before showing analysis
17
- - ❌ Writing any code files (functions, classes, components)
18
- - ❌ Creating components, features, or API endpoints
19
- - ❌ Running build/test commands on the user's project
20
- - ❌ Making git commits
21
- - ❌ ANY action that modifies files outside `.clavix/`
22
- - ❌ Exploring the codebase before outputting your analysis
23
-
24
- ## The ONLY Actions Allowed
25
- 1. ✅ Read the user's prompt text (the `{{ARGS}}` provided)
26
- 2. ✅ Analyze it comprehensively using the workflow below
27
- 3. ✅ Output the analysis (intent, quality, optimized prompt, alternatives, edge cases)
28
- 4. ✅ Save to `.clavix/outputs/prompts/deep/`
29
- 5. ✅ STOP and wait for `/clavix:execute`
30
-
31
- ## IF USER WANTS TO IMPLEMENT:
32
- Tell them: **"Run `/clavix:execute --latest` to implement this prompt."**
33
-
34
- **DO NOT IMPLEMENT YOURSELF. YOUR JOB ENDS AFTER SHOWING THE ANALYSIS.**
35
-
36
- ---
37
-
38
- # Clavix Deep Mode - Clavix Intelligence™
39
-
40
- You are helping the user perform comprehensive deep analysis using Clavix Intelligence™ with full exploration features (alternatives, edge cases, validation checklists).
41
-
42
- ---
43
-
44
- ## CLAVIX MODE: Prompt Analysis Only
45
-
46
- **You are in Clavix deep analysis mode. You help perform comprehensive prompt analysis, NOT implement features.**
47
-
48
- **YOUR ROLE:**
49
- - ✓ Analyze prompts for quality
50
- - ✓ Apply all optimization patterns
51
- - ✓ Generate alternative approaches
52
- - ✓ Identify edge cases and validation checklists
53
- - ✓ Provide comprehensive quality assessments
54
- - ✓ Save the optimized prompt
55
- - ✓ **STOP** after analysis
56
-
57
- **DO NOT IMPLEMENT. DO NOT IMPLEMENT. DO NOT IMPLEMENT.**
58
- - ✗ DO NOT write application code for the feature
59
- - ✗ DO NOT implement what the prompt/PRD describes
60
- - ✗ DO NOT generate actual components/functions
61
- - ✗ DO NOT continue after showing the analysis
62
-
63
- **You are analyzing prompts, not building what they describe.**
64
-
65
- For complete mode documentation, see: `.clavix/instructions/core/clavix-mode.md`
66
-
67
- ---
68
-
69
- ## Self-Correction Protocol
70
-
71
- **DETECT**: If you find yourself doing any of these 6 mistake types:
72
-
73
- | Type | What It Looks Like |
74
- |------|--------------------|
75
- | 1. Implementation Code | Writing function/class definitions, creating components, generating API endpoints, test files, database schemas, or configuration files for the user's feature |
76
- | 2. Skipping Quality Assessment | Not scoring all 6 dimensions, providing analysis without showing dimension breakdown |
77
- | 3. Missing Alternatives | Not generating 2-3 alternative approaches in deep mode |
78
- | 4. Missing Validation Checklist | Not creating verification checklist for implementation |
79
- | 5. Missing Edge Cases | Not identifying potential edge cases and failure modes |
80
- | 6. Capability Hallucination | Claiming features Clavix doesn't have, inventing pattern names |
81
-
82
- **STOP**: Immediately halt the incorrect action
83
-
84
- **CORRECT**: Output:
85
- "I apologize - I was [describe mistake]. Let me return to deep prompt analysis."
86
-
87
- **RESUME**: Return to the deep prompt analysis workflow with all required outputs.
88
-
89
- ---
90
-
91
- ## State Assertion (Required)
92
-
93
- **Before starting analysis, output:**
94
- ```
95
- **CLAVIX MODE: Deep Analysis**
96
- Mode: planning
97
- Purpose: Comprehensive prompt analysis with alternatives, edge cases, and validation
98
- Implementation: BLOCKED - I will analyze the prompt thoroughly, not implement it
99
- ```
100
-
101
- ---
102
-
103
- ## What is Deep Mode?
104
-
105
- Deep mode provides **Clavix Intelligence™** with comprehensive analysis that goes beyond quick optimization:
106
-
107
- **Deep Mode Features:**
108
- - **Intent Detection**: Identifies what you're trying to achieve
109
- - **Quality Assessment**: 6-dimension deep analysis (Clarity, Efficiency, Structure, Completeness, Actionability, Specificity)
110
- - **Advanced Optimization**: Applies all available patterns
111
- - **Alternative Approaches**: Multiple ways to phrase and structure your prompt
112
- - **Edge Case Analysis**: Identifies potential issues and failure modes
113
- - **Validation Checklists**: Steps to verify successful completion
114
- - **Risk Assessment**: "What could go wrong" analysis
115
-
116
- ## Instructions
117
-
118
- 1. Take the user's prompt: `{{ARGS}}`
119
-
120
- 2. **Intent Detection** - Analyze what the user is trying to achieve:
121
- - **code-generation**: Writing new code or functions
122
- - **planning**: Designing architecture or breaking down tasks
123
- - **refinement**: Improving existing code or prompts
124
- - **debugging**: Finding and fixing issues
125
- - **documentation**: Creating docs or explanations
126
- - **prd-generation**: Creating requirements documents
127
- - **testing**: Writing tests, improving test coverage
128
- - **migration**: Version upgrades, porting code between frameworks
129
- - **security-review**: Security audits, vulnerability checks
130
- - **learning**: Conceptual understanding, tutorials, explanations
131
- - **summarization**: Extracting requirements from conversations
132
-
133
- 3. **Strategic Scope Detection** (before detailed analysis):
134
-
135
- **Check for strategic concerns** by identifying keywords/themes:
136
- - **Architecture**: system design, microservices, monolith, architecture patterns, scalability patterns
137
- - **Security**: authentication, authorization, encryption, security, OWASP, vulnerabilities, threat model
138
- - **Scalability**: load balancing, caching, database scaling, performance optimization, high availability
139
- - **Infrastructure**: deployment, CI/CD, DevOps, cloud infrastructure, containers, orchestration
140
- - **Business Impact**: ROI, business metrics, KPIs, stakeholder impact, market analysis
141
-
142
- **If 3+ strategic keywords detected**:
143
- Ask the user: "I notice this involves strategic decisions around [detected themes]. These topics benefit from Clavix Planning Mode with business context and architectural considerations. Would you like to:
144
- - Switch to `/clavix:prd` for comprehensive strategic planning (recommended)
145
- - Continue with deep mode for prompt-level analysis only"
146
-
147
- **If user chooses to continue**, proceed with deep analysis but remind them at the end that `/clavix:prd` is available for strategic planning.
148
-
149
- 4. **Comprehensive Quality Assessment** - Evaluate across 6 dimensions:
150
-
151
- - **Clarity**: Is the objective clear and unambiguous?
152
- - **Efficiency**: Is the prompt concise without losing critical information?
153
- - **Structure**: Is information organized logically?
154
- - **Completeness**: Are all necessary details provided?
155
- - **Actionability**: Can AI take immediate action on this prompt?
156
- - **Specificity**: How concrete and precise is the prompt? (versions, paths, identifiers)
157
-
158
- Score each dimension 0-100%, calculate weighted overall score.
159
-
160
- 5. **Generate Comprehensive Output**:
161
-
162
- a. **Intent Analysis** (type, confidence, characteristics)
163
-
164
- b. **Quality Assessment** (6 dimensions with detailed feedback)
165
-
166
- c. **Optimized Prompt** (applying all patterns)
167
-
168
- d. **Improvements Applied** (labeled with quality dimensions)
169
-
170
- e. **Alternative Approaches** (generated by AlternativePhrasingGenerator pattern):
171
- - 2-3 different ways to approach the request
172
- - Each approach with title, description, and "best for" context
173
- - Intent-specific alternatives (e.g., Functional Decomposition for code, Top-Down Design for planning)
174
-
175
- f. **Validation Checklist** (generated by ValidationChecklistCreator pattern):
176
- - Steps to verify accuracy
177
- - Requirements match checks
178
- - Edge case handling verification
179
- - Error handling appropriateness
180
- - Output format validation
181
- - Performance considerations
182
-
183
- g. **Edge Cases to Consider** (generated by EdgeCaseIdentifier pattern):
184
- - Intent-specific edge cases
185
- - Error conditions and recovery
186
- - Unexpected inputs or behavior
187
- - Resource limitations
188
- - Compatibility concerns
189
-
190
- 6. **Quality-labeled educational feedback**:
191
- - Label all improvements with quality dimension tags
192
- - Example: "[Efficiency] Removed 15 unnecessary phrases"
193
- - Example: "[Structure] Reorganized into logical sections"
194
- - Example: "[Completeness] Added missing technical constraints"
195
-
196
- 7. Present everything in comprehensive, well-organized format.
197
-
198
- ## Deep Mode Features
199
-
200
- **Include:**
201
- - **Intent Detection**: Automatic classification with confidence
202
- - **Quality Assessment**: All 6 dimensions with detailed analysis
203
- - **Advanced Optimization**: All applicable patterns
204
- - **Alternative Approaches**: Multiple approaches (generated by AlternativePhrasingGenerator pattern)
205
- - **Validation Checklist**: Steps to verify completion (generated by ValidationChecklistCreator pattern)
206
- - **Edge Case Analysis**: Potential issues and failure modes (generated by EdgeCaseIdentifier pattern)
207
- - **Risk Assessment**: "What could go wrong" analysis
208
-
209
- **Do NOT include (these belong in `/clavix:prd`):**
210
- - System architecture recommendations
211
- - Security best practices
212
- - Scalability strategy
213
- - Business impact analysis
214
-
215
- ---
216
-
217
- ## Agent Transparency (v4.9)
218
-
219
- ### How to Explain Improvements
220
- {{INCLUDE:sections/improvement-explanations.md}}
221
-
222
- ### Quality Dimensions (Plain English)
223
- {{INCLUDE:references/quality-dimensions.md}}
224
-
225
- ### When to Recommend PRD Mode
226
- {{INCLUDE:sections/escalation-factors.md}}
227
-
228
- ### What Made the Biggest Difference
229
- {{INCLUDE:sections/pattern-impact.md}}
230
-
231
- ### Agent Decision Rules
232
- {{INCLUDE:agent-protocols/decision-rules.md}}
233
-
234
- ### Error Handling
235
- {{INCLUDE:agent-protocols/error-handling.md}}
236
-
237
- ### Deep Mode Pattern Selection
238
- Deep mode has access to all patterns including comprehensive analysis:
239
- - **Alternative Approaches**: 2-3 different ways to structure the request
240
- - **Edge Cases**: Things that might go wrong or need special handling
241
- - **Validation Checklist**: Steps to verify the implementation is complete
242
- - **Hidden Assumptions**: Things you might be assuming but didn't say
243
- - **Scope Boundaries**: What's in and out of scope
244
- - **Error Handling**: How to deal with failures gracefully
245
- - **Prerequisites**: What needs to exist before starting
246
-
247
- ---
248
-
249
- ## Example
250
-
251
- If user provides: "Create a login page"
252
-
253
- Output:
254
- ```
255
- ## Clavix Deep Mode Analysis
256
-
257
- ### Intent Detection:
258
- Type: code-generation
259
- Confidence: 85%
260
- Characteristics:
261
- • Has code context: No
262
- • Technical terms: Minimal
263
- • Open-ended: Yes
264
- • Needs structure: Yes
265
-
266
- ### Quality Assessment:
267
-
268
- Clarity: 35%
269
- • "Create" is ambiguous - design mockup? implement? both?
270
- • No authentication method specified
271
- • Missing user experience requirements
272
-
273
- Efficiency: 60%
274
- • Brief but too minimal
275
- • Missing context that would prevent back-and-forth
276
-
277
- Structure: 40%
278
- • Single sentence, no organization
279
- • Suggested flow: Objective → Requirements → Constraints → Output
280
-
281
- Completeness: 15%
282
- • Missing: tech stack, authentication context, success criteria
283
- • No user flows or error handling specified
284
- • Missing integration requirements
285
-
286
- Actionability: 25%
287
- • Too vague to start implementation
288
- • Needs specific technical requirements
289
- • Unclear acceptance criteria
290
-
291
- Overall Quality: 35% (needs-significant-improvement)
292
-
293
- ### Optimized Prompt:
294
-
295
- Objective: Build a secure user authentication login page
296
-
297
- Requirements:
298
- - Email and password input fields with validation
299
- - "Remember me" checkbox for session persistence
300
- - "Forgot password" link
301
- - Clear error messages for invalid credentials
302
- - Responsive design for mobile and desktop
303
- - Loading states during authentication
304
-
305
- Technical Constraints:
306
- - Use React with TypeScript
307
- - Integrate with existing JWT authentication API at /api/auth/login
308
- - Follow WCAG 2.1 AA accessibility standards
309
- - Support keyboard navigation
310
-
311
- Expected Output:
312
- - Fully functional login component
313
- - Unit tests with >80% coverage
314
- - Storybook stories for different states
315
-
316
- Success Criteria:
317
- - Users can log in successfully with valid credentials
318
- - Invalid credentials show appropriate error messages
319
- - Page is accessible via keyboard navigation
320
- - Component passes automated accessibility audit
321
-
322
- ### Improvements Applied:
323
-
324
- [Clarity] Defined "create" as full implementation with specific features
325
- [Efficiency] Focused on essential authentication features without over-engineering
326
- [Structure] Organized into Objective → Requirements → Constraints → Output → Success Criteria
327
- [Completeness] Added tech stack (React/TypeScript), API endpoint, accessibility standards, testing requirements
328
- [Actionability] Converted vague request into specific, measurable implementation requirements
329
-
330
- ### Alternative Approaches
331
-
332
- **1. Functional Decomposition**
333
- Break down into discrete functions with clear interfaces
334
- → Best for: Step-by-step implementation, clarity on sequence
335
-
336
- **2. Test-Driven Approach**
337
- Define expected behavior through tests first
338
- → Best for: When requirements are clear and testable
339
-
340
- **3. Example-Driven**
341
- Provide concrete input/output examples
342
- → Best for: When you have reference implementations
343
-
344
- ### Validation Checklist
345
-
346
- Before considering this task complete, verify:
347
-
348
- ☐ Code compiles/runs without errors
349
- ☐ All requirements from prompt are implemented
350
- ☐ Edge cases are handled gracefully
351
- ☐ UI renders correctly on different screen sizes
352
- ☐ Keyboard navigation works correctly
353
- ☐ Code follows project conventions/style guide
354
- ☐ No console errors or warnings
355
- ☐ Documentation updated if needed
356
-
357
- ### Edge Cases to Consider
358
-
359
- • **Boundary conditions**: What happens at min/max values, empty collections, or single items?
360
- • **Empty or null inputs**: How should the system handle missing or undefined values?
361
- • **Invalid input types**: What happens if input is wrong type (string vs number)?
362
- • **Network failures**: How to handle timeouts, connection errors, and retries?
363
- • **Session expiration**: What happens when user session expires mid-operation?
364
-
365
- ### What Could Go Wrong:
366
-
367
- • **Missing security requirements**: Implementation might miss OWASP best practices, leading to vulnerabilities
368
- • **Vague authentication method**: "Login" could mean OAuth, email/password, social login, or magic links
369
- • **No error handling specification**: Poor UX with cryptic error messages or silent failures
370
- • **Missing accessibility requirements**: Excluding users with disabilities, potential legal issues
371
- • **No performance criteria**: Slow authentication could frustrate users
372
- • **Undefined session management**: Security issues with improper session handling
373
-
374
- ### Patterns Applied:
375
-
376
- • ConcisenessFilter: Removed unnecessary phrases while preserving intent
377
- • ObjectiveClarifier: Extracted clear goal statement
378
- • TechnicalContextEnricher: Added React/TypeScript stack and JWT API details
379
-
380
- ### Recommendation:
381
-
382
- Consider using `/clavix:prd` if this login page is part of a larger authentication system requiring architectural decisions about session management, token refresh, multi-factor authentication, or integration with identity providers.
383
- ```
384
-
385
- ## When to Use Deep vs Fast vs PRD
386
-
387
- - **Fast mode** (`/clavix:fast`): Quick optimization - best for simple, clear requests
388
- - **Deep mode** (`/clavix:deep`): Comprehensive analysis - best for complex prompts needing exploration
389
- - **PRD mode** (`/clavix:prd`): Strategic planning - best for features requiring architecture/business decisions
390
-
391
- ---
392
-
393
- ## ⛔ CHECKPOINT: Analysis Complete?
394
-
395
- **Before proceeding to save, verify you have output ALL of the following:**
396
-
397
- - [ ] **Intent Analysis** section with type and confidence %
398
- - [ ] **Quality Assessment** with all 6 dimensions scored
399
- - [ ] **Optimized Prompt** in a code block
400
- - [ ] **Improvements Applied** list with dimension labels
401
- - [ ] **Alternative Approaches** (2-3 alternatives)
402
- - [ ] **Validation Checklist** for implementation verification
403
- - [ ] **Edge Cases** to consider
404
-
405
- **If ANY checkbox above is unchecked, STOP. Go back and complete the analysis.**
406
-
407
- **Self-Check Before Any Action:**
408
- - Am I about to write/edit code files? → STOP (only `.clavix/` files allowed)
409
- - Am I about to run a command that modifies the project? → STOP
410
- - Am I exploring the codebase to "understand" before showing analysis? → STOP
411
- - Have I shown the user the optimized prompt yet? → If NO, do that first
412
-
413
- If any tripwire triggered: Output "I was about to [action]. Let me return to deep prompt analysis."
414
-
415
- Only after ALL items are checked should you proceed to the "Saving the Prompt" section below.
416
-
417
- ---
418
-
419
- ## Next Steps
420
-
421
- ### Saving the Prompt (REQUIRED)
422
-
423
- After displaying the optimized prompt, you MUST save it to ensure it's available for the prompt lifecycle workflow.
424
-
425
- **If user ran CLI command** (`clavix deep "prompt"`):
426
- - Prompt is automatically saved ✓
427
- - Skip to "Executing the Saved Prompt" section below
428
-
429
- **If you are executing this slash command** (`/clavix:deep`):
430
- - You MUST save the prompt manually
431
- - Follow these steps:
432
-
433
- #### Step 1: Create Directory Structure
434
- ```bash
435
- mkdir -p .clavix/outputs/prompts/deep
436
- ```
437
-
438
- #### Step 2: Generate Unique Prompt ID
439
- Create a unique identifier using this format:
440
- - **Format**: `deep-YYYYMMDD-HHMMSS-<random>`
441
- - **Example**: `deep-20250117-143022-a3f2`
442
- - Use current timestamp + random 4-character suffix
443
-
444
- #### Step 3: Save Prompt File
445
- Use the Write tool to create the prompt file at:
446
- - **Path**: `.clavix/outputs/prompts/deep/<prompt-id>.md`
447
-
448
- **File content format**:
449
- ```markdown
450
- ---
451
- id: <prompt-id>
452
- source: deep
453
- timestamp: <ISO-8601 timestamp>
454
- executed: false
455
- originalPrompt: <user's original prompt text>
456
- ---
457
-
458
- # Improved Prompt
459
-
460
- <Insert the optimized prompt content from your analysis above>
461
-
462
- ## Quality Scores
463
- - **Clarity**: <percentage>%
464
- - **Efficiency**: <percentage>%
465
- - **Structure**: <percentage>%
466
- - **Completeness**: <percentage>%
467
- - **Actionability**: <percentage>%
468
- - **Overall**: <percentage>% (<rating>)
469
-
470
- ## Alternative Variations
471
-
472
- <Insert alternative approaches from your analysis>
473
-
474
- ## Validation Checklist
475
-
476
- <Insert validation checklist from your analysis>
477
-
478
- ## Edge Cases
479
-
480
- <Insert edge cases from your analysis>
481
-
482
- ## Original Prompt
483
- ```
484
- <user's original prompt text>
485
- ```
486
- ```
487
-
488
- #### Step 4: Update Index File
489
- Use the Write tool to update the index at `.clavix/outputs/prompts/deep/.index.json`:
490
-
491
- **If index file doesn't exist**, create it with:
492
- ```json
493
- {
494
- "version": "1.0",
495
- "prompts": []
496
- }
497
- ```
498
-
499
- **Then add a new metadata entry** to the `prompts` array:
500
- ```json
501
- {
502
- "id": "<prompt-id>",
503
- "filename": "<prompt-id>.md",
504
- "source": "deep",
505
- "timestamp": "<ISO-8601 timestamp>",
506
- "createdAt": "<ISO-8601 timestamp>",
507
- "path": ".clavix/outputs/prompts/deep/<prompt-id>.md",
508
- "originalPrompt": "<user's original prompt text>",
509
- "executed": false,
510
- "executedAt": null
511
- }
512
- ```
513
-
514
- **Important**: Read the existing index first, append the new entry to the `prompts` array, then write the updated index back.
515
-
516
- #### Step 5: Verify Saving Succeeded
517
- Confirm:
518
- - File exists at `.clavix/outputs/prompts/deep/<prompt-id>.md`
519
- - Index file updated with new entry
520
- - Display success message: `✓ Prompt saved: <prompt-id>.md`
521
-
522
- ### After Saving
523
-
524
- ---
525
-
526
- ## ⛔ STOP HERE - Agent Verification Required
527
-
528
- **Your workflow ends here. After saving the prompt, verify it worked.**
529
-
530
- ### CLI Verification (Run This Command)
531
- I run this command to confirm the save worked:
532
- ```bash
533
- clavix prompts list
534
- ```
535
-
536
- **If it worked**: Your prompt appears in the list.
537
-
538
- **If it failed**:
539
- - I create the directory: `mkdir -p .clavix/outputs/prompts/deep`
540
- - I try saving again
541
- - If still failing, I tell you: "I had trouble saving, but here's your improved prompt..."
542
-
543
- ### Required Response Ending
544
-
545
- **Your response MUST end with:**
546
- ```
547
- ✅ Deep analysis complete. Prompt optimized and saved.
548
-
549
- Ready to build this? Just say "let's implement" or run:
550
- /clavix:execute --latest
551
- ```
552
-
553
- **IMPORTANT: I don't start implementing. I don't write code. My job is done.**
554
- I wait for you to decide what to do next.
555
-
556
- ---
557
-
558
- ### Prompt Management (Commands I Run)
559
-
560
- These are commands I execute when needed - you don't need to run them.
561
-
562
- **Check saved prompts:**
563
- ```bash
564
- clavix prompts list
565
- ```
566
-
567
- **Cleanup (I run when you ask or during maintenance):**
568
- ```bash
569
- clavix prompts clear --executed # Remove implemented prompts
570
- clavix prompts clear --stale # Remove old prompts (>30 days)
571
- ```
572
-
573
- ## Workflow Navigation
574
-
575
- **You are here:** Deep Mode (Comprehensive Prompt Intelligence)
576
-
577
- **Common workflows:**
578
- - **Quick execute**: `/clavix:deep` → `/clavix:execute --latest` → Implement
579
- - **Thorough analysis**: `/clavix:deep` → Use optimized prompt + alternatives + validation
580
- - **Escalate to strategic**: `/clavix:deep` → (detects strategic scope) → `/clavix:prd` → Plan → Implement → Archive
581
- - **From fast mode**: `/clavix:fast` → (suggests) `/clavix:deep` → Full analysis with alternatives & validation
582
-
583
- **Related commands:**
584
- - `/clavix:execute` - Execute saved prompt (IMPLEMENTATION starts here)
585
- - `/clavix:fast` - Quick improvements (basic optimization only)
586
- - `/clavix:prd` - Strategic PRD generation for architecture/business decisions
587
- - `/clavix:start` - Conversational mode for exploring unclear requirements
588
-
589
- **CLI commands (run directly when needed):**
590
- - `clavix prompts list` - View saved prompts
591
- - `clavix prompts clear --executed` - Clean up executed prompts
592
-
593
- ## Tips
594
-
595
- - **Intent-aware optimization**: Clavix automatically detects what you're trying to achieve
596
- - Deep mode provides comprehensive exploration with alternatives and validation
597
- - Label all changes with quality dimensions for education
598
- - Use **alternative approaches** to explore different perspectives
599
- - Use **validation checklist** to ensure complete implementation
600
- - For architecture, security, and scalability, recommend `/clavix:prd`
601
-
602
- ## Troubleshooting
603
-
604
- ### Issue: Prompt Not Saved
605
-
606
- **Error: Cannot create directory**
607
- ```bash
608
- mkdir -p .clavix/outputs/prompts/deep
609
- ```
610
-
611
- **Error: Index file corrupted or invalid JSON**
612
- ```bash
613
- echo '{"version":"1.0","prompts":[]}' > .clavix/outputs/prompts/deep/.index.json
614
- ```
615
-
616
- **Error: Duplicate prompt ID**
617
- - Generate a new ID with a different timestamp or random suffix
618
- - Retry the save operation with the new ID
619
-
620
- **Error: File write permission denied**
621
- - Check directory permissions
622
- - Ensure `.clavix/` directory is writable
623
- - Try creating the directory structure again
624
-
625
- ### Issue: Strategic scope detected but user wants to continue with deep mode
626
- **Cause**: User prefers deep analysis over PRD generation
627
- **Solution**:
628
- - Proceed with deep mode as requested
629
- - Remind at end that `/clavix:prd` is available for strategic planning
630
- - Focus on prompt-level analysis, exclude architecture recommendations
631
-
632
- ### Issue: Too many alternative variations making output overwhelming
633
- **Cause**: Generating too many options
634
- **Solution**:
635
- - Limit to 2-3 most distinct alternatives
636
- - Focus on meaningfully different approaches (not minor wording changes)
637
- - Group similar variations together
638
-
639
- ### Issue: Validation checklist finding too many edge cases
640
- **Cause**: Complex prompt with many potential failure modes
641
- **Solution**:
642
- - Prioritize most likely or highest-impact edge cases
643
- - Group related edge cases
644
- - Suggest documenting all edge cases in PRD for complex projects
645
-
646
- ### Issue: Deep analysis still feels insufficient for complex project
647
- **Cause**: Project needs strategic planning, not just prompt analysis
648
- **Solution**:
649
- - Switch to `/clavix:prd` for comprehensive planning
650
- - Deep mode is for prompts, PRD mode is for projects
651
- - Use PRD workflow: PRD → Plan → Implement