clavix 4.12.0 → 5.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 (163) hide show
  1. package/README.md +69 -61
  2. package/dist/cli/commands/init.js +54 -153
  3. package/dist/cli/commands/update.js +19 -21
  4. package/dist/templates/agents/agents.md +28 -26
  5. package/dist/templates/agents/copilot-instructions.md +42 -36
  6. package/dist/templates/agents/octo.md +41 -36
  7. package/dist/templates/agents/warp.md +24 -24
  8. package/dist/templates/instructions/README.md +8 -5
  9. package/dist/templates/slash-commands/_canonical/archive.md +83 -121
  10. package/dist/templates/slash-commands/_canonical/execute.md +32 -42
  11. package/dist/templates/slash-commands/_canonical/implement.md +32 -44
  12. package/dist/templates/slash-commands/_canonical/improve.md +13 -52
  13. package/dist/templates/slash-commands/_canonical/plan.md +8 -20
  14. package/dist/templates/slash-commands/_canonical/verify.md +9 -9
  15. package/dist/templates/slash-commands/_components/agent-protocols/assertion-checkpoints.md +1 -1
  16. package/dist/templates/slash-commands/_components/agent-protocols/cli-reference.md +84 -180
  17. package/dist/templates/slash-commands/_components/agent-protocols/decision-rules.md +5 -6
  18. package/dist/templates/slash-commands/_components/agent-protocols/error-handling.md +2 -2
  19. package/dist/templates/slash-commands/_components/agent-protocols/file-formats.md +41 -59
  20. package/dist/templates/slash-commands/_components/agent-protocols/state-awareness.md +5 -7
  21. package/dist/templates/slash-commands/_components/sections/file-saving-protocol.md +20 -27
  22. package/dist/templates/slash-commands/_components/troubleshooting/file-not-saved.md +4 -5
  23. package/dist/templates/slash-commands/_components/troubleshooting/vibecoder-recovery.md +2 -2
  24. package/dist/utils/agent-error-messages.js +13 -12
  25. package/package.json +2 -2
  26. package/dist/cli/commands/analyze.d.ts +0 -17
  27. package/dist/cli/commands/analyze.js +0 -133
  28. package/dist/cli/commands/archive.d.ts +0 -36
  29. package/dist/cli/commands/archive.js +0 -266
  30. package/dist/cli/commands/deep.d.ts +0 -17
  31. package/dist/cli/commands/deep.js +0 -170
  32. package/dist/cli/commands/execute.d.ts +0 -15
  33. package/dist/cli/commands/execute.js +0 -168
  34. package/dist/cli/commands/fast.d.ts +0 -18
  35. package/dist/cli/commands/fast.js +0 -219
  36. package/dist/cli/commands/implement.d.ts +0 -24
  37. package/dist/cli/commands/implement.js +0 -289
  38. package/dist/cli/commands/improve.d.ts +0 -32
  39. package/dist/cli/commands/improve.js +0 -250
  40. package/dist/cli/commands/list.d.ts +0 -17
  41. package/dist/cli/commands/list.js +0 -217
  42. package/dist/cli/commands/plan.d.ts +0 -21
  43. package/dist/cli/commands/plan.js +0 -297
  44. package/dist/cli/commands/prd.d.ts +0 -24
  45. package/dist/cli/commands/prd.js +0 -321
  46. package/dist/cli/commands/prompts/clear.d.ts +0 -16
  47. package/dist/cli/commands/prompts/clear.js +0 -222
  48. package/dist/cli/commands/prompts/list.d.ts +0 -8
  49. package/dist/cli/commands/prompts/list.js +0 -88
  50. package/dist/cli/commands/show.d.ts +0 -21
  51. package/dist/cli/commands/show.js +0 -191
  52. package/dist/cli/commands/start.d.ts +0 -40
  53. package/dist/cli/commands/start.js +0 -210
  54. package/dist/cli/commands/summarize.d.ts +0 -17
  55. package/dist/cli/commands/summarize.js +0 -196
  56. package/dist/cli/commands/task-complete.d.ts +0 -27
  57. package/dist/cli/commands/task-complete.js +0 -269
  58. package/dist/cli/commands/verify.d.ts +0 -28
  59. package/dist/cli/commands/verify.js +0 -349
  60. package/dist/core/archive-manager.d.ts +0 -100
  61. package/dist/core/archive-manager.js +0 -302
  62. package/dist/core/basic-checklist-generator.d.ts +0 -35
  63. package/dist/core/basic-checklist-generator.js +0 -344
  64. package/dist/core/checklist-parser.d.ts +0 -48
  65. package/dist/core/checklist-parser.js +0 -238
  66. package/dist/core/config-manager.d.ts +0 -149
  67. package/dist/core/config-manager.js +0 -230
  68. package/dist/core/conversation-analyzer.d.ts +0 -86
  69. package/dist/core/conversation-analyzer.js +0 -387
  70. package/dist/core/conversation-quality-tracker.d.ts +0 -81
  71. package/dist/core/conversation-quality-tracker.js +0 -195
  72. package/dist/core/git-manager.d.ts +0 -126
  73. package/dist/core/git-manager.js +0 -282
  74. package/dist/core/intelligence/confidence-calculator.d.ts +0 -93
  75. package/dist/core/intelligence/confidence-calculator.js +0 -124
  76. package/dist/core/intelligence/index.d.ts +0 -11
  77. package/dist/core/intelligence/index.js +0 -15
  78. package/dist/core/intelligence/intent-detector.d.ts +0 -54
  79. package/dist/core/intelligence/intent-detector.js +0 -723
  80. package/dist/core/intelligence/pattern-library.d.ts +0 -104
  81. package/dist/core/intelligence/pattern-library.js +0 -330
  82. package/dist/core/intelligence/patterns/actionability-enhancer.d.ts +0 -27
  83. package/dist/core/intelligence/patterns/actionability-enhancer.js +0 -192
  84. package/dist/core/intelligence/patterns/alternative-phrasing-generator.d.ts +0 -29
  85. package/dist/core/intelligence/patterns/alternative-phrasing-generator.js +0 -239
  86. package/dist/core/intelligence/patterns/ambiguity-detector.d.ts +0 -22
  87. package/dist/core/intelligence/patterns/ambiguity-detector.js +0 -196
  88. package/dist/core/intelligence/patterns/assumption-explicitizer.d.ts +0 -30
  89. package/dist/core/intelligence/patterns/assumption-explicitizer.js +0 -296
  90. package/dist/core/intelligence/patterns/base-pattern.d.ts +0 -192
  91. package/dist/core/intelligence/patterns/base-pattern.js +0 -103
  92. package/dist/core/intelligence/patterns/completeness-validator.d.ts +0 -27
  93. package/dist/core/intelligence/patterns/completeness-validator.js +0 -221
  94. package/dist/core/intelligence/patterns/conciseness-filter.d.ts +0 -20
  95. package/dist/core/intelligence/patterns/conciseness-filter.js +0 -92
  96. package/dist/core/intelligence/patterns/context-precision.d.ts +0 -32
  97. package/dist/core/intelligence/patterns/context-precision.js +0 -389
  98. package/dist/core/intelligence/patterns/conversation-summarizer.d.ts +0 -30
  99. package/dist/core/intelligence/patterns/conversation-summarizer.js +0 -277
  100. package/dist/core/intelligence/patterns/dependency-identifier.d.ts +0 -23
  101. package/dist/core/intelligence/patterns/dependency-identifier.js +0 -166
  102. package/dist/core/intelligence/patterns/domain-context-enricher.d.ts +0 -21
  103. package/dist/core/intelligence/patterns/domain-context-enricher.js +0 -198
  104. package/dist/core/intelligence/patterns/edge-case-identifier.d.ts +0 -30
  105. package/dist/core/intelligence/patterns/edge-case-identifier.js +0 -269
  106. package/dist/core/intelligence/patterns/error-tolerance-enhancer.d.ts +0 -22
  107. package/dist/core/intelligence/patterns/error-tolerance-enhancer.js +0 -179
  108. package/dist/core/intelligence/patterns/implicit-requirement-extractor.d.ts +0 -24
  109. package/dist/core/intelligence/patterns/implicit-requirement-extractor.js +0 -259
  110. package/dist/core/intelligence/patterns/objective-clarifier.d.ts +0 -22
  111. package/dist/core/intelligence/patterns/objective-clarifier.js +0 -126
  112. package/dist/core/intelligence/patterns/output-format-enforcer.d.ts +0 -22
  113. package/dist/core/intelligence/patterns/output-format-enforcer.js +0 -151
  114. package/dist/core/intelligence/patterns/prd-structure-enforcer.d.ts +0 -23
  115. package/dist/core/intelligence/patterns/prd-structure-enforcer.js +0 -183
  116. package/dist/core/intelligence/patterns/prerequisite-identifier.d.ts +0 -23
  117. package/dist/core/intelligence/patterns/prerequisite-identifier.js +0 -221
  118. package/dist/core/intelligence/patterns/requirement-prioritizer.d.ts +0 -24
  119. package/dist/core/intelligence/patterns/requirement-prioritizer.js +0 -134
  120. package/dist/core/intelligence/patterns/scope-definer.d.ts +0 -26
  121. package/dist/core/intelligence/patterns/scope-definer.js +0 -236
  122. package/dist/core/intelligence/patterns/step-decomposer.d.ts +0 -31
  123. package/dist/core/intelligence/patterns/step-decomposer.js +0 -242
  124. package/dist/core/intelligence/patterns/structure-organizer.d.ts +0 -31
  125. package/dist/core/intelligence/patterns/structure-organizer.js +0 -218
  126. package/dist/core/intelligence/patterns/success-criteria-enforcer.d.ts +0 -22
  127. package/dist/core/intelligence/patterns/success-criteria-enforcer.js +0 -165
  128. package/dist/core/intelligence/patterns/success-metrics-enforcer.d.ts +0 -24
  129. package/dist/core/intelligence/patterns/success-metrics-enforcer.js +0 -165
  130. package/dist/core/intelligence/patterns/technical-context-enricher.d.ts +0 -25
  131. package/dist/core/intelligence/patterns/technical-context-enricher.js +0 -165
  132. package/dist/core/intelligence/patterns/topic-coherence-analyzer.d.ts +0 -26
  133. package/dist/core/intelligence/patterns/topic-coherence-analyzer.js +0 -300
  134. package/dist/core/intelligence/patterns/user-persona-enricher.d.ts +0 -24
  135. package/dist/core/intelligence/patterns/user-persona-enricher.js +0 -141
  136. package/dist/core/intelligence/patterns/validation-checklist-creator.d.ts +0 -31
  137. package/dist/core/intelligence/patterns/validation-checklist-creator.js +0 -242
  138. package/dist/core/intelligence/quality-assessor.d.ts +0 -71
  139. package/dist/core/intelligence/quality-assessor.js +0 -525
  140. package/dist/core/intelligence/types.d.ts +0 -111
  141. package/dist/core/intelligence/types.js +0 -3
  142. package/dist/core/intelligence/universal-optimizer.d.ts +0 -91
  143. package/dist/core/intelligence/universal-optimizer.js +0 -399
  144. package/dist/core/prd-generator.d.ts +0 -76
  145. package/dist/core/prd-generator.js +0 -173
  146. package/dist/core/prompt-manager.d.ts +0 -110
  147. package/dist/core/prompt-manager.js +0 -274
  148. package/dist/core/prompt-optimizer.d.ts +0 -268
  149. package/dist/core/prompt-optimizer.js +0 -959
  150. package/dist/core/question-engine.d.ts +0 -167
  151. package/dist/core/question-engine.js +0 -356
  152. package/dist/core/session-manager.d.ts +0 -139
  153. package/dist/core/session-manager.js +0 -365
  154. package/dist/core/task-manager.d.ts +0 -211
  155. package/dist/core/task-manager.js +0 -981
  156. package/dist/core/verification-hooks.d.ts +0 -67
  157. package/dist/core/verification-hooks.js +0 -309
  158. package/dist/core/verification-manager.d.ts +0 -107
  159. package/dist/core/verification-manager.js +0 -415
  160. package/dist/types/session.d.ts +0 -78
  161. package/dist/types/session.js +0 -8
  162. package/dist/types/verification.d.ts +0 -205
  163. package/dist/types/verification.js +0 -9
@@ -1,387 +0,0 @@
1
- /**
2
- * ConversationAnalyzer - Analyzes conversation sessions and extracts structured requirements
3
- *
4
- * This class handles:
5
- * - Conversation analysis and pattern extraction
6
- * - Key requirement identification
7
- * - Technical constraint extraction
8
- * - Success criteria identification
9
- * - Mini-PRD and optimized prompt generation
10
- */
11
- /**
12
- * ConversationAnalyzer class
13
- *
14
- * Analyzes conversational sessions to extract structured requirements
15
- * suitable for PRD generation or AI prompting
16
- */
17
- export class ConversationAnalyzer {
18
- /**
19
- * Analyze a conversation session
20
- *
21
- * @param session - The session to analyze
22
- * @returns Structured analysis of the conversation
23
- */
24
- analyze(session) {
25
- const userMessages = session.messages
26
- .filter((m) => m.role === 'user')
27
- .map((m) => m.content);
28
- return {
29
- summary: this.extractSummary(userMessages, session.projectName),
30
- keyRequirements: this.extractKeyRequirements(userMessages),
31
- technicalConstraints: this.extractTechnicalConstraints(userMessages),
32
- successCriteria: this.extractSuccessCriteria(userMessages),
33
- outOfScope: this.extractOutOfScope(userMessages),
34
- additionalContext: this.extractAdditionalContext(userMessages),
35
- };
36
- }
37
- /**
38
- * Generate a mini-PRD from analyzed conversation
39
- *
40
- * @param session - The session
41
- * @param analysis - The conversation analysis
42
- * @returns Mini-PRD content
43
- */
44
- generateMiniPrd(session, analysis) {
45
- const lines = [];
46
- lines.push(`# Mini-PRD: ${session.projectName}`);
47
- lines.push('');
48
- lines.push(`*Generated from conversation session ${session.id}*`);
49
- lines.push('');
50
- lines.push('---');
51
- lines.push('');
52
- // Summary
53
- lines.push('## Summary');
54
- lines.push('');
55
- lines.push(analysis.summary);
56
- lines.push('');
57
- // Key Requirements
58
- if (analysis.keyRequirements.length > 0) {
59
- lines.push('## Key Requirements');
60
- lines.push('');
61
- analysis.keyRequirements.forEach((req) => {
62
- lines.push(`- ${req}`);
63
- });
64
- lines.push('');
65
- }
66
- // Technical Constraints
67
- if (analysis.technicalConstraints.length > 0) {
68
- lines.push('## Technical Constraints');
69
- lines.push('');
70
- analysis.technicalConstraints.forEach((constraint) => {
71
- lines.push(`- ${constraint}`);
72
- });
73
- lines.push('');
74
- }
75
- // Success Criteria
76
- if (analysis.successCriteria.length > 0) {
77
- lines.push('## Success Criteria');
78
- lines.push('');
79
- analysis.successCriteria.forEach((criteria) => {
80
- lines.push(`- ${criteria}`);
81
- });
82
- lines.push('');
83
- }
84
- // Out of Scope
85
- if (analysis.outOfScope.length > 0) {
86
- lines.push('## Out of Scope');
87
- lines.push('');
88
- analysis.outOfScope.forEach((item) => {
89
- lines.push(`- ${item}`);
90
- });
91
- lines.push('');
92
- }
93
- // Additional Context
94
- if (analysis.additionalContext.length > 0) {
95
- lines.push('## Additional Context');
96
- lines.push('');
97
- analysis.additionalContext.forEach((context) => {
98
- lines.push(`- ${context}`);
99
- });
100
- lines.push('');
101
- }
102
- // Metadata
103
- lines.push('---');
104
- lines.push('');
105
- lines.push('**Conversation Details:**');
106
- lines.push(`- Session ID: ${session.id}`);
107
- lines.push(`- Messages: ${session.messages.length}`);
108
- lines.push(`- Created: ${session.created.toLocaleString()}`);
109
- lines.push(`- Updated: ${session.updated.toLocaleString()}`);
110
- lines.push('');
111
- return lines.join('\n');
112
- }
113
- /**
114
- * Generate an optimized prompt for AI consumption
115
- *
116
- * @param session - The session
117
- * @param analysis - The conversation analysis
118
- * @returns Optimized prompt content
119
- */
120
- generateOptimizedPrompt(session, analysis) {
121
- const lines = [];
122
- lines.push(`# Development Task: ${session.projectName}`);
123
- lines.push('');
124
- lines.push('## Objective');
125
- lines.push('');
126
- lines.push(analysis.summary);
127
- lines.push('');
128
- // Core Requirements
129
- if (analysis.keyRequirements.length > 0) {
130
- lines.push('## Core Requirements');
131
- lines.push('');
132
- lines.push('Please implement the following:');
133
- lines.push('');
134
- analysis.keyRequirements.forEach((req, index) => {
135
- lines.push(`${index + 1}. ${req}`);
136
- });
137
- lines.push('');
138
- }
139
- // Technical Constraints
140
- if (analysis.technicalConstraints.length > 0) {
141
- lines.push('## Technical Constraints');
142
- lines.push('');
143
- lines.push('Ensure the implementation adheres to these constraints:');
144
- lines.push('');
145
- analysis.technicalConstraints.forEach((constraint) => {
146
- lines.push(`- ${constraint}`);
147
- });
148
- lines.push('');
149
- }
150
- // Success Criteria
151
- if (analysis.successCriteria.length > 0) {
152
- lines.push('## Success Criteria');
153
- lines.push('');
154
- lines.push('The implementation is complete when:');
155
- lines.push('');
156
- analysis.successCriteria.forEach((criteria) => {
157
- lines.push(`- [ ] ${criteria}`);
158
- });
159
- lines.push('');
160
- }
161
- // Out of Scope
162
- if (analysis.outOfScope.length > 0) {
163
- lines.push('## Explicitly Out of Scope');
164
- lines.push('');
165
- lines.push('Do NOT implement:');
166
- lines.push('');
167
- analysis.outOfScope.forEach((item) => {
168
- lines.push(`- ${item}`);
169
- });
170
- lines.push('');
171
- }
172
- // Additional Context
173
- if (analysis.additionalContext.length > 0) {
174
- lines.push('## Additional Context');
175
- lines.push('');
176
- analysis.additionalContext.forEach((context) => {
177
- lines.push(context);
178
- lines.push('');
179
- });
180
- }
181
- // Instructions
182
- lines.push('---');
183
- lines.push('');
184
- lines.push('**Development Instructions:**');
185
- lines.push('');
186
- lines.push('Please implement a solution that:');
187
- lines.push('- Addresses all core requirements');
188
- lines.push('- Respects technical constraints');
189
- lines.push('- Meets all success criteria');
190
- lines.push('- Is well-structured, maintainable, and tested');
191
- lines.push('');
192
- lines.push('Focus on creating production-quality code with proper error handling, documentation, and tests.');
193
- lines.push('');
194
- return lines.join('\n');
195
- }
196
- /**
197
- * Extract a summary from the conversation
198
- */
199
- extractSummary(messages, projectName) {
200
- if (messages.length === 0) {
201
- return `This project (${projectName}) requires development based on the following requirements.`;
202
- }
203
- // Use the first message as the primary summary, or combine first few messages
204
- const firstMessage = messages[0];
205
- if (messages.length === 1) {
206
- return firstMessage;
207
- }
208
- // Try to create a concise summary from the conversation
209
- const combinedText = messages.slice(0, 3).join(' ');
210
- if (combinedText.length <= 300) {
211
- return combinedText;
212
- }
213
- return firstMessage;
214
- }
215
- /**
216
- * Extract key requirements from messages
217
- */
218
- extractKeyRequirements(messages) {
219
- const requirements = [];
220
- // Keywords that indicate requirements
221
- const requirementPatterns = [
222
- /(?:need|want|should|must|require)(?:s)?\s+(?:to\s+)?(.+?)(?:\.|$)/gi,
223
- /(?:implement|add|create|build|develop)\s+(.+?)(?:\.|$)/gi,
224
- /(?:feature|functionality):\s*(.+?)(?:\.|$)/gi,
225
- ];
226
- for (const message of messages) {
227
- for (const pattern of requirementPatterns) {
228
- const matches = [...message.matchAll(pattern)];
229
- for (const match of matches) {
230
- if (match[1]) {
231
- const requirement = match[1].trim();
232
- if (requirement.length > 10 && requirement.length < 200) {
233
- requirements.push(this.cleanupText(requirement));
234
- }
235
- }
236
- }
237
- }
238
- // Also capture direct statements (messages that don't match patterns)
239
- if (!this.matchesAnyPattern(message, requirementPatterns)) {
240
- const cleaned = this.cleanupText(message);
241
- if (cleaned.length > 10 && cleaned.length < 200) {
242
- requirements.push(cleaned);
243
- }
244
- }
245
- }
246
- // Remove duplicates and limit
247
- return [...new Set(requirements)].slice(0, 10);
248
- }
249
- /**
250
- * Extract technical constraints from messages
251
- */
252
- extractTechnicalConstraints(messages) {
253
- const constraints = [];
254
- const technicalKeywords = [
255
- 'typescript', 'javascript', 'python', 'java', 'node', 'react', 'vue', 'angular',
256
- 'database', 'sql', 'nosql', 'mongodb', 'postgres', 'mysql',
257
- 'api', 'rest', 'graphql', 'websocket',
258
- 'authentication', 'oauth', 'jwt', 'security',
259
- 'performance', 'scale', 'cache', 'redis',
260
- 'docker', 'kubernetes', 'aws', 'azure', 'gcp',
261
- 'framework', 'library', 'package', 'version',
262
- ];
263
- for (const message of messages) {
264
- const lowerMessage = message.toLowerCase();
265
- // Check for technical keywords
266
- for (const keyword of technicalKeywords) {
267
- if (lowerMessage.includes(keyword)) {
268
- // Extract the sentence containing the keyword
269
- const sentences = message.split(/[.!?]+/);
270
- for (const sentence of sentences) {
271
- if (sentence.toLowerCase().includes(keyword)) {
272
- const cleaned = this.cleanupText(sentence);
273
- if (cleaned.length > 10) {
274
- constraints.push(cleaned);
275
- }
276
- break;
277
- }
278
- }
279
- }
280
- }
281
- }
282
- // Remove duplicates and limit
283
- return [...new Set(constraints)].slice(0, 8);
284
- }
285
- /**
286
- * Extract success criteria from messages
287
- */
288
- extractSuccessCriteria(messages) {
289
- const criteria = [];
290
- const criteriaPatterns = [
291
- /(?:success|successful|complete|done)\s+(?:when|if|criteria):\s*(.+?)(?:\.|$)/gi,
292
- /(?:should be able to)\s+(.+?)(?:\.|$)/gi,
293
- /(?:must|has to)\s+(.+?)(?:\.|$)/gi,
294
- ];
295
- for (const message of messages) {
296
- for (const pattern of criteriaPatterns) {
297
- const matches = [...message.matchAll(pattern)];
298
- for (const match of matches) {
299
- if (match[1]) {
300
- const criterion = this.cleanupText(match[1]);
301
- if (criterion.length > 10) {
302
- criteria.push(criterion);
303
- }
304
- }
305
- }
306
- }
307
- }
308
- // If no explicit criteria found, infer from requirements
309
- if (criteria.length === 0 && messages.length > 0) {
310
- criteria.push('All core requirements are implemented and functional');
311
- criteria.push('Code is tested and well-documented');
312
- }
313
- return [...new Set(criteria)].slice(0, 6);
314
- }
315
- /**
316
- * Extract out-of-scope items from messages
317
- */
318
- extractOutOfScope(messages) {
319
- const outOfScope = [];
320
- const outOfScopePatterns = [
321
- /(?:don't|do not|don't)\s+(?:need|want|include)\s+(.+?)(?:\.|$)/gi,
322
- /(?:not|no)\s+(?:in scope|necessary|needed|required):\s*(.+?)(?:\.|$)/gi,
323
- /(?:skip|ignore|exclude)\s+(.+?)(?:\.|$)/gi,
324
- ];
325
- for (const message of messages) {
326
- for (const pattern of outOfScopePatterns) {
327
- const matches = [...message.matchAll(pattern)];
328
- for (const match of matches) {
329
- if (match[1]) {
330
- const item = this.cleanupText(match[1]);
331
- if (item.length > 10) {
332
- outOfScope.push(item);
333
- }
334
- }
335
- }
336
- }
337
- }
338
- return [...new Set(outOfScope)].slice(0, 5);
339
- }
340
- /**
341
- * Extract additional context from messages
342
- */
343
- extractAdditionalContext(messages) {
344
- const context = [];
345
- // Look for context indicators
346
- const contextPatterns = [
347
- /(?:context|background|note):\s*(.+?)(?:\.|$)/gi,
348
- /(?:important|note that|keep in mind)\s+(.+?)(?:\.|$)/gi,
349
- ];
350
- for (const message of messages) {
351
- for (const pattern of contextPatterns) {
352
- const matches = [...message.matchAll(pattern)];
353
- for (const match of matches) {
354
- if (match[1]) {
355
- const item = this.cleanupText(match[1]);
356
- if (item.length > 10) {
357
- context.push(item);
358
- }
359
- }
360
- }
361
- }
362
- }
363
- return [...new Set(context)].slice(0, 5);
364
- }
365
- /**
366
- * Clean up extracted text
367
- */
368
- cleanupText(text) {
369
- return text
370
- .trim()
371
- .replace(/\s+/g, ' ')
372
- .replace(/^[,\s]+/, '')
373
- .replace(/[,\s]+$/, '');
374
- }
375
- /**
376
- * Check if message matches any pattern
377
- */
378
- matchesAnyPattern(message, patterns) {
379
- for (const pattern of patterns) {
380
- if (pattern.test(message)) {
381
- return true;
382
- }
383
- }
384
- return false;
385
- }
386
- }
387
- //# sourceMappingURL=conversation-analyzer.js.map
@@ -1,81 +0,0 @@
1
- /**
2
- * v4.3.2: Conversation Quality Tracker
3
- *
4
- * Implements the "Supportive Companion" UX pattern for conversational mode.
5
- * Silently tracks quality, provides positive reinforcement, and gentle guidance.
6
- */
7
- export interface TrackedTopic {
8
- name: string;
9
- confidence: number;
10
- firstMentioned: number;
11
- }
12
- export interface ConversationQuality {
13
- topics: TrackedTopic[];
14
- overallCompleteness: number;
15
- ambiguityLevel: number;
16
- messageCount: number;
17
- }
18
- export interface NudgeResult {
19
- shouldNudge: boolean;
20
- message?: string;
21
- gap?: string;
22
- }
23
- /**
24
- * ConversationQualityTracker - "Supportive Companion" UX
25
- *
26
- * Design principles:
27
- * - Silent tracking during normal flow
28
- * - Celebrate progress, don't criticize gaps
29
- * - Gentle nudge only for critical issues (max 1 per session)
30
- * - Always reassure that Clavix will help
31
- */
32
- export declare class ConversationQualityTracker {
33
- private topics;
34
- private messageCount;
35
- private hasNudged;
36
- private lastCheckpointAt;
37
- private readonly TOPIC_KEYWORDS;
38
- private readonly CRITICAL_TOPICS;
39
- /**
40
- * Track a new message (silent analysis)
41
- */
42
- trackMessage(content: string): void;
43
- /**
44
- * Get positive checkpoint message (call after ~5 messages or on "status")
45
- * Returns null if not time for a checkpoint
46
- */
47
- getPositiveCheckpoint(): string | null;
48
- /**
49
- * Check if a gentle nudge is needed (max 1 per session, only for critical gaps)
50
- */
51
- shouldNudge(): NudgeResult;
52
- /**
53
- * Get reassuring end-of-session message
54
- */
55
- getEndMessage(): string;
56
- /**
57
- * Get current quality metrics (for internal use)
58
- */
59
- calculateQuality(): ConversationQuality;
60
- /**
61
- * Get list of covered topics (user-friendly names)
62
- */
63
- private getCoveredTopics;
64
- /**
65
- * Find a critical gap to nudge about
66
- */
67
- private findCriticalGap;
68
- /**
69
- * Analyze message content for topic coverage
70
- */
71
- private analyzeTopics;
72
- /**
73
- * Reset tracker for new session
74
- */
75
- reset(): void;
76
- /**
77
- * Get summary for debugging/logging
78
- */
79
- getSummary(): string;
80
- }
81
- //# sourceMappingURL=conversation-quality-tracker.d.ts.map
@@ -1,195 +0,0 @@
1
- /**
2
- * v4.3.2: Conversation Quality Tracker
3
- *
4
- * Implements the "Supportive Companion" UX pattern for conversational mode.
5
- * Silently tracks quality, provides positive reinforcement, and gentle guidance.
6
- */
7
- /**
8
- * ConversationQualityTracker - "Supportive Companion" UX
9
- *
10
- * Design principles:
11
- * - Silent tracking during normal flow
12
- * - Celebrate progress, don't criticize gaps
13
- * - Gentle nudge only for critical issues (max 1 per session)
14
- * - Always reassure that Clavix will help
15
- */
16
- export class ConversationQualityTracker {
17
- topics = new Map();
18
- messageCount = 0;
19
- hasNudged = false;
20
- lastCheckpointAt = 0;
21
- // Topic detection keywords
22
- TOPIC_KEYWORDS = {
23
- features: ['feature', 'functionality', 'should', 'must', 'need', 'want', 'capability'],
24
- 'tech stack': [
25
- 'react',
26
- 'node',
27
- 'typescript',
28
- 'python',
29
- 'database',
30
- 'api',
31
- 'backend',
32
- 'frontend',
33
- ],
34
- constraints: [
35
- 'constraint',
36
- 'limitation',
37
- 'budget',
38
- 'timeline',
39
- 'deadline',
40
- 'must not',
41
- 'cannot',
42
- ],
43
- users: ['user', 'customer', 'audience', 'persona', 'who will'],
44
- goals: ['goal', 'objective', 'purpose', 'why', 'problem', 'solve'],
45
- scope: ['scope', 'out of scope', 'not include', 'exclude', 'later', 'mvp'],
46
- success: ['success', 'metric', 'kpi', 'measure', 'criteria'],
47
- design: ['design', 'ui', 'ux', 'layout', 'interface', 'look'],
48
- };
49
- // Critical gaps that warrant a nudge (only if quality < 40%)
50
- CRITICAL_TOPICS = ['features', 'goals'];
51
- /**
52
- * Track a new message (silent analysis)
53
- */
54
- trackMessage(content) {
55
- this.messageCount++;
56
- this.analyzeTopics(content);
57
- }
58
- /**
59
- * Get positive checkpoint message (call after ~5 messages or on "status")
60
- * Returns null if not time for a checkpoint
61
- */
62
- getPositiveCheckpoint() {
63
- // Only show checkpoint every 5 messages
64
- if (this.messageCount < 5 || this.messageCount - this.lastCheckpointAt < 5) {
65
- return null;
66
- }
67
- this.lastCheckpointAt = this.messageCount;
68
- const coveredTopics = this.getCoveredTopics();
69
- if (coveredTopics.length === 0) {
70
- return null;
71
- }
72
- // Format covered topics nicely
73
- const topicList = coveredTopics.slice(0, 3).join(', ');
74
- return `📝 Shaping up nicely! Covered: ${topicList}. Continue or /summarize anytime.`;
75
- }
76
- /**
77
- * Check if a gentle nudge is needed (max 1 per session, only for critical gaps)
78
- */
79
- shouldNudge() {
80
- // Only nudge once per session
81
- if (this.hasNudged) {
82
- return { shouldNudge: false };
83
- }
84
- // Only nudge after a few messages
85
- if (this.messageCount < 3) {
86
- return { shouldNudge: false };
87
- }
88
- // Only nudge if quality is low
89
- const quality = this.calculateQuality();
90
- if (quality.overallCompleteness >= 40) {
91
- return { shouldNudge: false };
92
- }
93
- // Find critical gap
94
- const criticalGap = this.findCriticalGap();
95
- if (!criticalGap) {
96
- return { shouldNudge: false };
97
- }
98
- // Mark that we've nudged
99
- this.hasNudged = true;
100
- return {
101
- shouldNudge: true,
102
- gap: criticalGap,
103
- message: `💡 One thought: a note about ${criticalGap} would help. No worries—Clavix will fill gaps when you summarize.`,
104
- };
105
- }
106
- /**
107
- * Get reassuring end-of-session message
108
- */
109
- getEndMessage() {
110
- const coveredTopics = this.getCoveredTopics();
111
- if (coveredTopics.length === 0) {
112
- return '✨ Session recorded! Clavix Intelligence will help structure your requirements.';
113
- }
114
- if (coveredTopics.length >= 3) {
115
- return '✨ Great session! You covered several key areas. Clavix Intelligence will enhance your summary.';
116
- }
117
- return '✨ Great session! Clavix Intelligence will enhance your summary with any missing pieces.';
118
- }
119
- /**
120
- * Get current quality metrics (for internal use)
121
- */
122
- calculateQuality() {
123
- const topics = Array.from(this.topics.values());
124
- // Calculate completeness based on covered topics
125
- const totalPossibleTopics = Object.keys(this.TOPIC_KEYWORDS).length;
126
- const coveredCount = topics.filter((t) => t.confidence >= 30).length;
127
- const overallCompleteness = Math.min(100, Math.round((coveredCount / totalPossibleTopics) * 100));
128
- // Estimate ambiguity (higher if fewer topics covered with low confidence)
129
- const avgConfidence = topics.length > 0 ? topics.reduce((sum, t) => sum + t.confidence, 0) / topics.length : 0;
130
- const ambiguityLevel = Math.max(0, 100 - avgConfidence);
131
- return {
132
- topics,
133
- overallCompleteness,
134
- ambiguityLevel,
135
- messageCount: this.messageCount,
136
- };
137
- }
138
- /**
139
- * Get list of covered topics (user-friendly names)
140
- */
141
- getCoveredTopics() {
142
- return Array.from(this.topics.values())
143
- .filter((t) => t.confidence >= 30)
144
- .sort((a, b) => b.confidence - a.confidence)
145
- .map((t) => t.name);
146
- }
147
- /**
148
- * Find a critical gap to nudge about
149
- */
150
- findCriticalGap() {
151
- for (const topic of this.CRITICAL_TOPICS) {
152
- const tracked = this.topics.get(topic);
153
- if (!tracked || tracked.confidence < 20) {
154
- return topic;
155
- }
156
- }
157
- return null;
158
- }
159
- /**
160
- * Analyze message content for topic coverage
161
- */
162
- analyzeTopics(content) {
163
- const lowerContent = content.toLowerCase();
164
- for (const [topic, keywords] of Object.entries(this.TOPIC_KEYWORDS)) {
165
- const matchedKeywords = keywords.filter((kw) => lowerContent.includes(kw));
166
- if (matchedKeywords.length > 0) {
167
- const existing = this.topics.get(topic);
168
- const confidence = Math.min(100, matchedKeywords.length * 25 + (existing?.confidence || 0));
169
- this.topics.set(topic, {
170
- name: topic,
171
- confidence,
172
- firstMentioned: existing?.firstMentioned || this.messageCount,
173
- });
174
- }
175
- }
176
- }
177
- /**
178
- * Reset tracker for new session
179
- */
180
- reset() {
181
- this.topics.clear();
182
- this.messageCount = 0;
183
- this.hasNudged = false;
184
- this.lastCheckpointAt = 0;
185
- }
186
- /**
187
- * Get summary for debugging/logging
188
- */
189
- getSummary() {
190
- const quality = this.calculateQuality();
191
- const topics = this.getCoveredTopics();
192
- return `Messages: ${this.messageCount}, Topics: [${topics.join(', ')}], Completeness: ${quality.overallCompleteness}%`;
193
- }
194
- }
195
- //# sourceMappingURL=conversation-quality-tracker.js.map