clavix 2.8.2 → 3.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 (55) hide show
  1. package/README.md +26 -6
  2. package/dist/cli/commands/deep.d.ts +3 -4
  3. package/dist/cli/commands/deep.js +162 -261
  4. package/dist/cli/commands/fast.d.ts +3 -4
  5. package/dist/cli/commands/fast.js +126 -303
  6. package/dist/cli/commands/init.js +184 -22
  7. package/dist/cli/commands/prd.d.ts +7 -6
  8. package/dist/cli/commands/prd.js +113 -132
  9. package/dist/cli/commands/summarize.d.ts +1 -12
  10. package/dist/cli/commands/summarize.js +63 -131
  11. package/dist/core/intelligence/index.d.ts +10 -0
  12. package/dist/core/intelligence/index.js +13 -0
  13. package/dist/core/intelligence/intent-detector.d.ts +33 -0
  14. package/dist/core/intelligence/intent-detector.js +311 -0
  15. package/dist/core/intelligence/pattern-library.d.ts +44 -0
  16. package/dist/core/intelligence/pattern-library.js +103 -0
  17. package/dist/core/intelligence/patterns/actionability-enhancer.d.ts +27 -0
  18. package/dist/core/intelligence/patterns/actionability-enhancer.js +162 -0
  19. package/dist/core/intelligence/patterns/base-pattern.d.ts +31 -0
  20. package/dist/core/intelligence/patterns/base-pattern.js +39 -0
  21. package/dist/core/intelligence/patterns/completeness-validator.d.ts +27 -0
  22. package/dist/core/intelligence/patterns/completeness-validator.js +135 -0
  23. package/dist/core/intelligence/patterns/conciseness-filter.d.ts +12 -0
  24. package/dist/core/intelligence/patterns/conciseness-filter.js +61 -0
  25. package/dist/core/intelligence/patterns/objective-clarifier.d.ts +14 -0
  26. package/dist/core/intelligence/patterns/objective-clarifier.js +97 -0
  27. package/dist/core/intelligence/patterns/structure-organizer.d.ts +31 -0
  28. package/dist/core/intelligence/patterns/structure-organizer.js +185 -0
  29. package/dist/core/intelligence/patterns/technical-context-enricher.d.ts +16 -0
  30. package/dist/core/intelligence/patterns/technical-context-enricher.js +132 -0
  31. package/dist/core/intelligence/quality-assessor.d.ts +42 -0
  32. package/dist/core/intelligence/quality-assessor.js +296 -0
  33. package/dist/core/intelligence/types.d.ts +81 -0
  34. package/dist/core/intelligence/types.js +3 -0
  35. package/dist/core/intelligence/universal-optimizer.d.ts +31 -0
  36. package/dist/core/intelligence/universal-optimizer.js +118 -0
  37. package/dist/core/prd-generator.d.ts +2 -2
  38. package/dist/core/task-manager.js +18 -5
  39. package/dist/templates/agents/agents.md +2 -2
  40. package/dist/templates/agents/copilot-instructions.md +15 -15
  41. package/dist/templates/agents/octo.md +35 -30
  42. package/dist/templates/agents/warp.md +3 -3
  43. package/dist/templates/full-prd-template.hbs +1 -1
  44. package/dist/templates/prd-questions.md +1 -1
  45. package/dist/templates/quick-prd-template.hbs +1 -1
  46. package/dist/templates/slash-commands/_canonical/deep.md +261 -122
  47. package/dist/templates/slash-commands/_canonical/fast.md +101 -69
  48. package/dist/templates/slash-commands/_canonical/implement.md +1 -1
  49. package/dist/templates/slash-commands/_canonical/plan.md +12 -12
  50. package/dist/templates/slash-commands/_canonical/prd.md +34 -24
  51. package/dist/templates/slash-commands/_canonical/start.md +13 -12
  52. package/dist/templates/slash-commands/_canonical/summarize.md +42 -25
  53. package/dist/utils/error-utils.d.ts +7 -0
  54. package/dist/utils/error-utils.js +17 -0
  55. package/package.json +21 -12
@@ -0,0 +1,296 @@
1
+ export class QualityAssessor {
2
+ /**
3
+ * Assess quality of a prompt (backward compatibility wrapper)
4
+ * @deprecated Use assess() method instead for full quality metrics
5
+ */
6
+ assessQuality(prompt, intent) {
7
+ // Create minimal IntentAnalysis from string intent
8
+ const intentAnalysis = {
9
+ primaryIntent: intent,
10
+ confidence: 100,
11
+ characteristics: {
12
+ hasCodeContext: false,
13
+ hasTechnicalTerms: false,
14
+ isOpenEnded: false,
15
+ needsStructure: false
16
+ }
17
+ };
18
+ // Call existing assess method with same prompt for both original and enhanced
19
+ const result = this.assess(prompt, prompt, intentAnalysis);
20
+ // Return only the numeric scores (exclude strengths and improvements arrays)
21
+ return {
22
+ clarity: result.clarity,
23
+ efficiency: result.efficiency,
24
+ structure: result.structure,
25
+ completeness: result.completeness,
26
+ actionability: result.actionability,
27
+ overall: result.overall
28
+ };
29
+ }
30
+ /**
31
+ * Assess quality of a prompt
32
+ */
33
+ assess(original, enhanced, intent) {
34
+ const clarity = this.assessClarity(enhanced, intent);
35
+ const efficiency = this.assessEfficiency(enhanced);
36
+ const structure = this.assessStructure(enhanced, intent);
37
+ const completeness = this.assessCompleteness(enhanced, intent);
38
+ const actionability = this.assessActionability(enhanced, intent);
39
+ const overall = this.calculateOverall({ clarity, efficiency, structure, completeness, actionability }, intent);
40
+ const strengths = this.identifyStrengths(enhanced, { clarity, efficiency, structure, completeness, actionability });
41
+ const improvements = this.identifyImprovements(original, enhanced);
42
+ return {
43
+ clarity,
44
+ efficiency,
45
+ structure,
46
+ completeness,
47
+ actionability,
48
+ overall,
49
+ strengths,
50
+ improvements
51
+ };
52
+ }
53
+ assessClarity(prompt, intent) {
54
+ let score = 100;
55
+ const lowerPrompt = prompt.toLowerCase();
56
+ // Check for objective statement
57
+ if (!this.hasObjective(prompt)) {
58
+ score -= 20;
59
+ }
60
+ // Check for technical specifications (for code generation)
61
+ if (intent.primaryIntent === 'code-generation') {
62
+ if (!this.hasTechStack(prompt)) {
63
+ score -= 15;
64
+ }
65
+ if (!this.hasOutputFormat(prompt)) {
66
+ score -= 15;
67
+ }
68
+ }
69
+ // Check for success criteria
70
+ if (!this.hasSuccessCriteria(prompt)) {
71
+ score -= 10;
72
+ }
73
+ // Check for vague language
74
+ const vagueTerms = ['something', 'somehow', 'maybe', 'kind of', 'sort of', 'stuff', 'things'];
75
+ const vagueCount = vagueTerms.filter(term => lowerPrompt.includes(term)).length;
76
+ score -= vagueCount * 5;
77
+ return Math.max(0, Math.min(100, score));
78
+ }
79
+ assessEfficiency(prompt) {
80
+ let score = 100;
81
+ // Check for pleasantries
82
+ const pleasantries = ['please', 'thank you', 'thanks', 'could you', 'would you'];
83
+ const lowerPrompt = prompt.toLowerCase();
84
+ const pleasantryCount = pleasantries.filter(p => lowerPrompt.includes(p)).length;
85
+ score -= pleasantryCount * 5;
86
+ // Check for fluff words
87
+ const fluffWords = ['very', 'really', 'just', 'basically', 'simply', 'actually', 'literally'];
88
+ const fluffCount = fluffWords.filter(w => lowerPrompt.includes(w)).length;
89
+ score -= fluffCount * 3;
90
+ // Calculate signal-to-noise ratio
91
+ const words = prompt.split(/\s+/);
92
+ const signalWords = this.countSignalWords(prompt);
93
+ const ratio = words.length > 0 ? signalWords / words.length : 0;
94
+ if (ratio < 0.6) {
95
+ score -= 30;
96
+ }
97
+ else if (ratio < 0.75) {
98
+ score -= 15;
99
+ }
100
+ return Math.max(0, Math.min(100, score));
101
+ }
102
+ assessStructure(prompt, intent) {
103
+ let score = 100;
104
+ // Check for logical flow: context → requirements → constraints → output
105
+ const hasContext = this.hasSection(prompt, ['context', 'background', 'currently']);
106
+ const hasRequirements = this.hasSection(prompt, ['requirement', 'need', 'should', 'must']);
107
+ const hasConstraints = this.hasSection(prompt, ['constraint', 'limit', 'within']);
108
+ const hasOutput = this.hasSection(prompt, ['output', 'result', 'deliverable', 'expected']);
109
+ // Penalize missing sections based on intent
110
+ if (intent.primaryIntent !== 'refinement' && !hasContext) {
111
+ score -= 20;
112
+ }
113
+ if (!hasRequirements) {
114
+ score -= 25;
115
+ }
116
+ if (!hasOutput) {
117
+ score -= 15;
118
+ }
119
+ // Check for markdown structure
120
+ const hasHeaders = /^#+\s+/m.test(prompt);
121
+ if (hasHeaders) {
122
+ score += 10; // Bonus for using headers
123
+ }
124
+ return Math.max(0, Math.min(100, score));
125
+ }
126
+ assessCompleteness(prompt, intent) {
127
+ let score = 100;
128
+ const lowerPrompt = prompt.toLowerCase();
129
+ // Intent-specific completeness checks
130
+ if (intent.primaryIntent === 'code-generation') {
131
+ if (!this.hasTechStack(prompt))
132
+ score -= 20;
133
+ if (!this.hasInputOutput(prompt))
134
+ score -= 20;
135
+ if (!this.hasEdgeCases(prompt))
136
+ score -= 10;
137
+ }
138
+ else if (intent.primaryIntent === 'planning') {
139
+ if (!this.hasProblemStatement(prompt))
140
+ score -= 25;
141
+ if (!this.hasGoal(prompt))
142
+ score -= 25;
143
+ if (!this.hasConstraints(prompt))
144
+ score -= 15;
145
+ }
146
+ else if (intent.primaryIntent === 'debugging') {
147
+ if (!lowerPrompt.includes('error'))
148
+ score -= 20;
149
+ if (!this.hasExpectedBehavior(prompt))
150
+ score -= 15;
151
+ if (!this.hasActualBehavior(prompt))
152
+ score -= 15;
153
+ }
154
+ return Math.max(0, Math.min(100, score));
155
+ }
156
+ assessActionability(prompt, intent) {
157
+ let score = 100;
158
+ const lowerPrompt = prompt.toLowerCase();
159
+ // Check for ambiguous terms
160
+ const ambiguousTerms = ['etc', 'and so on', 'or something', 'whatever', 'anything'];
161
+ const ambiguousCount = ambiguousTerms.filter(term => lowerPrompt.includes(term)).length;
162
+ score -= ambiguousCount * 10;
163
+ // Check for concrete examples
164
+ const hasExamples = this.hasExamples(prompt);
165
+ if (!hasExamples && intent.primaryIntent === 'code-generation') {
166
+ score -= 15;
167
+ }
168
+ // Check for clear success criteria
169
+ if (!this.hasSuccessCriteria(prompt)) {
170
+ score -= 20;
171
+ }
172
+ // Check for too many questions (makes it un-actionable)
173
+ const questionCount = (prompt.match(/\?/g) || []).length;
174
+ if (questionCount > 3) {
175
+ score -= questionCount * 5;
176
+ }
177
+ return Math.max(0, Math.min(100, score));
178
+ }
179
+ calculateOverall(scores, intent) {
180
+ // Intent-specific weights
181
+ if (intent.primaryIntent === 'code-generation') {
182
+ return (scores.clarity * 0.25 +
183
+ scores.completeness * 0.30 +
184
+ scores.actionability * 0.25 +
185
+ scores.efficiency * 0.10 +
186
+ scores.structure * 0.10);
187
+ }
188
+ else if (intent.primaryIntent === 'planning') {
189
+ return (scores.structure * 0.30 +
190
+ scores.completeness * 0.30 +
191
+ scores.clarity * 0.25 +
192
+ scores.efficiency * 0.10 +
193
+ scores.actionability * 0.05);
194
+ }
195
+ else if (intent.primaryIntent === 'debugging') {
196
+ return (scores.actionability * 0.35 +
197
+ scores.completeness * 0.30 +
198
+ scores.clarity * 0.20 +
199
+ scores.structure * 0.10 +
200
+ scores.efficiency * 0.05);
201
+ }
202
+ // Default weights
203
+ return (scores.clarity * 0.20 +
204
+ scores.efficiency * 0.15 +
205
+ scores.structure * 0.20 +
206
+ scores.completeness * 0.25 +
207
+ scores.actionability * 0.20);
208
+ }
209
+ identifyStrengths(prompt, scores) {
210
+ const strengths = [];
211
+ if (scores.clarity >= 85)
212
+ strengths.push('Clear objective and goals');
213
+ if (scores.efficiency >= 85)
214
+ strengths.push('Concise and focused');
215
+ if (scores.structure >= 85)
216
+ strengths.push('Well-structured with logical flow');
217
+ if (scores.completeness >= 85)
218
+ strengths.push('Comprehensive with all necessary details');
219
+ if (scores.actionability >= 85)
220
+ strengths.push('Immediately actionable');
221
+ return strengths;
222
+ }
223
+ identifyImprovements(original, enhanced) {
224
+ const improvements = [];
225
+ // This is a simplified version - in real implementation,
226
+ // we'd track what changed between original and enhanced
227
+ if (enhanced.length > original.length * 1.2) {
228
+ improvements.push('Added missing context and specifications');
229
+ }
230
+ if (enhanced.includes('# Objective') && !original.includes('# Objective')) {
231
+ improvements.push('Added clear objective statement');
232
+ }
233
+ if (enhanced.includes('# Technical Constraints') && !original.includes('# Technical Constraints')) {
234
+ improvements.push('Added technical context');
235
+ }
236
+ return improvements;
237
+ }
238
+ // Helper methods
239
+ hasObjective(prompt) {
240
+ return /objective|goal|purpose|need to|want to|^#+\s*objective/im.test(prompt);
241
+ }
242
+ hasTechStack(prompt) {
243
+ const techTerms = [
244
+ 'python', 'javascript', 'typescript', 'java', 'rust', 'go', 'php',
245
+ 'react', 'vue', 'angular', 'django', 'flask', 'express', 'spring'
246
+ ];
247
+ const lowerPrompt = prompt.toLowerCase();
248
+ return techTerms.some(term => lowerPrompt.includes(term));
249
+ }
250
+ hasOutputFormat(prompt) {
251
+ return /output|return|result|format|structure|response/i.test(prompt);
252
+ }
253
+ hasSuccessCriteria(prompt) {
254
+ return /success|criteria|metric|measure|test|verify|validate/i.test(prompt);
255
+ }
256
+ hasSection(prompt, keywords) {
257
+ const lowerPrompt = prompt.toLowerCase();
258
+ return keywords.some(keyword => lowerPrompt.includes(keyword));
259
+ }
260
+ countSignalWords(prompt) {
261
+ // Count words that carry meaning (not stop words)
262
+ const stopWords = new Set([
263
+ 'the', 'a', 'an', 'and', 'or', 'but', 'in', 'on', 'at', 'to', 'for',
264
+ 'of', 'with', 'by', 'from', 'as', 'is', 'was', 'are', 'were', 'been',
265
+ 'be', 'have', 'has', 'had', 'do', 'does', 'did', 'will', 'would', 'could',
266
+ 'should', 'may', 'might', 'can', 'this', 'that', 'these', 'those'
267
+ ]);
268
+ const words = prompt.toLowerCase().split(/\s+/);
269
+ return words.filter(word => !stopWords.has(word) && word.length > 2).length;
270
+ }
271
+ hasInputOutput(prompt) {
272
+ return /input|output|parameter|argument|return/i.test(prompt);
273
+ }
274
+ hasEdgeCases(prompt) {
275
+ return /edge case|empty|null|zero|negative|invalid|error/i.test(prompt);
276
+ }
277
+ hasProblemStatement(prompt) {
278
+ return /problem|issue|challenge|currently|pain point/i.test(prompt);
279
+ }
280
+ hasGoal(prompt) {
281
+ return /goal|objective|aim|purpose|achieve|accomplish/i.test(prompt);
282
+ }
283
+ hasConstraints(prompt) {
284
+ return /constraint|limit|must not|cannot|within|maximum|minimum/i.test(prompt);
285
+ }
286
+ hasExpectedBehavior(prompt) {
287
+ return /expected|should|supposed to|intended/i.test(prompt);
288
+ }
289
+ hasActualBehavior(prompt) {
290
+ return /actual|currently|instead|but|however|getting/i.test(prompt);
291
+ }
292
+ hasExamples(prompt) {
293
+ return /example|for instance|such as|like|e\.g\.|```/i.test(prompt);
294
+ }
295
+ }
296
+ //# sourceMappingURL=quality-assessor.js.map
@@ -0,0 +1,81 @@
1
+ export type PromptIntent = 'code-generation' | 'planning' | 'refinement' | 'debugging' | 'documentation' | 'prd-generation';
2
+ export type QualityDimension = 'clarity' | 'efficiency' | 'structure' | 'completeness' | 'actionability';
3
+ export type ImpactLevel = 'low' | 'medium' | 'high';
4
+ export type OptimizationMode = 'fast' | 'deep';
5
+ export interface IntentAnalysis {
6
+ primaryIntent: PromptIntent;
7
+ confidence: number;
8
+ characteristics: {
9
+ hasCodeContext: boolean;
10
+ hasTechnicalTerms: boolean;
11
+ isOpenEnded: boolean;
12
+ needsStructure: boolean;
13
+ };
14
+ suggestedMode?: OptimizationMode;
15
+ }
16
+ export interface QualityMetrics {
17
+ clarity: number;
18
+ efficiency: number;
19
+ structure: number;
20
+ completeness: number;
21
+ actionability: number;
22
+ overall: number;
23
+ strengths: string[];
24
+ improvements: string[];
25
+ remainingIssues?: string[];
26
+ }
27
+ export interface Improvement {
28
+ dimension: QualityDimension;
29
+ description: string;
30
+ impact: ImpactLevel;
31
+ }
32
+ export interface PatternContext {
33
+ intent: IntentAnalysis;
34
+ mode: OptimizationMode;
35
+ originalPrompt: string;
36
+ }
37
+ export interface PatternResult {
38
+ enhancedPrompt: string;
39
+ improvement: Improvement;
40
+ applied: boolean;
41
+ }
42
+ export interface PatternSummary {
43
+ name: string;
44
+ description: string;
45
+ impact: ImpactLevel;
46
+ }
47
+ export interface OptimizationResult {
48
+ original: string;
49
+ enhanced: string;
50
+ intent: IntentAnalysis;
51
+ quality: QualityMetrics;
52
+ improvements: Improvement[];
53
+ appliedPatterns: PatternSummary[];
54
+ mode: OptimizationMode;
55
+ processingTimeMs: number;
56
+ }
57
+ export interface AlternativeApproach {
58
+ title: string;
59
+ description: string;
60
+ prompt: string;
61
+ }
62
+ export interface AlternativeStructure {
63
+ type: 'step-by-step' | 'template-based' | 'example-driven';
64
+ title: string;
65
+ content: string;
66
+ }
67
+ export interface ValidationItem {
68
+ description: string;
69
+ checked: boolean;
70
+ }
71
+ export interface EdgeCase {
72
+ scenario: string;
73
+ consideration: string;
74
+ }
75
+ export interface DeepModeExtras {
76
+ alternatives: AlternativeApproach[];
77
+ structures: AlternativeStructure[];
78
+ validation: ValidationItem[];
79
+ edgeCases: EdgeCase[];
80
+ }
81
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,3 @@
1
+ // Core types for the universal prompt intelligence system
2
+ export {};
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,31 @@
1
+ import { IntentDetector } from './intent-detector.js';
2
+ import { PatternLibrary } from './pattern-library.js';
3
+ import { QualityAssessor } from './quality-assessor.js';
4
+ import { OptimizationResult, OptimizationMode } from './types.js';
5
+ export declare class UniversalOptimizer {
6
+ private intentDetector;
7
+ private patternLibrary;
8
+ private qualityAssessor;
9
+ constructor(intentDetector?: IntentDetector, patternLibrary?: PatternLibrary, qualityAssessor?: QualityAssessor);
10
+ /**
11
+ * Optimize a prompt using the universal intelligence system
12
+ */
13
+ optimize(prompt: string, mode: OptimizationMode): Promise<OptimizationResult>;
14
+ /**
15
+ * Determine if deep mode should be recommended (for fast mode results)
16
+ */
17
+ shouldRecommendDeepMode(result: OptimizationResult): boolean;
18
+ /**
19
+ * Get recommendation message for user
20
+ */
21
+ getRecommendation(result: OptimizationResult): string | null;
22
+ /**
23
+ * Get statistics about the optimizer
24
+ */
25
+ getStatistics(): {
26
+ totalPatterns: number;
27
+ fastModePatterns: number;
28
+ deepModePatterns: number;
29
+ };
30
+ }
31
+ //# sourceMappingURL=universal-optimizer.d.ts.map
@@ -0,0 +1,118 @@
1
+ import { IntentDetector } from './intent-detector.js';
2
+ import { PatternLibrary } from './pattern-library.js';
3
+ import { QualityAssessor } from './quality-assessor.js';
4
+ export class UniversalOptimizer {
5
+ intentDetector;
6
+ patternLibrary;
7
+ qualityAssessor;
8
+ constructor(intentDetector, patternLibrary, qualityAssessor) {
9
+ this.intentDetector = intentDetector || new IntentDetector();
10
+ this.patternLibrary = patternLibrary || new PatternLibrary();
11
+ this.qualityAssessor = qualityAssessor || new QualityAssessor();
12
+ }
13
+ /**
14
+ * Optimize a prompt using the universal intelligence system
15
+ */
16
+ async optimize(prompt, mode) {
17
+ const startTime = Date.now();
18
+ // Step 1: Detect intent
19
+ const intent = this.intentDetector.analyze(prompt);
20
+ // Step 2: Select applicable patterns
21
+ const patterns = this.patternLibrary.selectPatterns(intent, mode);
22
+ // Step 3: Apply patterns sequentially
23
+ let enhanced = prompt;
24
+ const improvements = [];
25
+ const appliedPatterns = [];
26
+ const context = {
27
+ intent,
28
+ mode,
29
+ originalPrompt: prompt
30
+ };
31
+ for (const pattern of patterns) {
32
+ try {
33
+ const result = pattern.apply(enhanced, context);
34
+ if (result.applied) {
35
+ enhanced = result.enhancedPrompt;
36
+ improvements.push(result.improvement);
37
+ appliedPatterns.push({
38
+ name: pattern.name,
39
+ description: pattern.description,
40
+ impact: result.improvement.impact
41
+ });
42
+ }
43
+ }
44
+ catch (error) {
45
+ // Log error but continue with other patterns
46
+ console.error(`Error applying pattern ${pattern.id}:`, error);
47
+ }
48
+ }
49
+ // Step 4: Assess quality
50
+ const quality = this.qualityAssessor.assess(prompt, enhanced, intent);
51
+ // Step 5: Calculate processing time
52
+ const processingTimeMs = Date.now() - startTime;
53
+ return {
54
+ original: prompt,
55
+ enhanced,
56
+ intent,
57
+ quality,
58
+ improvements,
59
+ appliedPatterns,
60
+ mode,
61
+ processingTimeMs
62
+ };
63
+ }
64
+ /**
65
+ * Determine if deep mode should be recommended (for fast mode results)
66
+ */
67
+ shouldRecommendDeepMode(result) {
68
+ // Planning tasks benefit from deep mode
69
+ if (result.intent.primaryIntent === 'planning') {
70
+ return true;
71
+ }
72
+ // Low quality score suggests need for deep analysis
73
+ if (result.quality.overall < 65) {
74
+ return true;
75
+ }
76
+ // Open-ended tasks without clear structure
77
+ if (result.intent.characteristics.isOpenEnded && result.intent.characteristics.needsStructure) {
78
+ return true;
79
+ }
80
+ // Very short prompts with low completeness
81
+ if (result.original.length < 50 && result.quality.completeness < 70) {
82
+ return true;
83
+ }
84
+ return false;
85
+ }
86
+ /**
87
+ * Get recommendation message for user
88
+ */
89
+ getRecommendation(result) {
90
+ if (result.mode === 'fast' && this.shouldRecommendDeepMode(result)) {
91
+ return 'This prompt would benefit from comprehensive analysis. Run: /clavix:deep for alternative approaches and validation checklist';
92
+ }
93
+ if (result.quality.overall >= 90) {
94
+ return 'Excellent! Your prompt is AI-ready.';
95
+ }
96
+ if (result.quality.overall >= 80) {
97
+ return 'Good quality. Ready to use!';
98
+ }
99
+ if (result.quality.overall >= 70) {
100
+ return 'Decent quality. Consider the improvements listed above.';
101
+ }
102
+ return null;
103
+ }
104
+ /**
105
+ * Get statistics about the optimizer
106
+ */
107
+ getStatistics() {
108
+ const totalPatterns = this.patternLibrary.getPatternCount();
109
+ const fastModePatterns = this.patternLibrary.getPatternsByMode('fast').length;
110
+ const deepModePatterns = this.patternLibrary.getPatternsByMode('deep').length;
111
+ return {
112
+ totalPatterns,
113
+ fastModePatterns,
114
+ deepModePatterns
115
+ };
116
+ }
117
+ }
118
+ //# sourceMappingURL=universal-optimizer.js.map
@@ -63,11 +63,11 @@ export declare class PrdGenerator {
63
63
  /**
64
64
  * Generate full PRD document
65
65
  */
66
- private generateFullPrd;
66
+ generateFullPrd(data: Record<string, unknown>, outputPath: string): Promise<void>;
67
67
  /**
68
68
  * Generate quick PRD document
69
69
  */
70
- private generateQuickPrd;
70
+ generateQuickPrd(data: Record<string, unknown>, outputPath: string): Promise<void>;
71
71
  /**
72
72
  * Format timestamp for display
73
73
  */
@@ -130,7 +130,7 @@ export class TaskManager {
130
130
  * Generate phases from core features with intelligent grouping
131
131
  * CRITICAL FIX: Group related features instead of 1 phase per bullet
132
132
  */
133
- generatePhasesFromCoreFeatures(coreContent, options) {
133
+ generatePhasesFromCoreFeatures(coreContent, _options) {
134
134
  const bullets = this.extractListItems(coreContent);
135
135
  if (bullets.length === 0) {
136
136
  return [];
@@ -188,7 +188,6 @@ export class TaskManager {
188
188
  'Integration & Release': [],
189
189
  };
190
190
  features.forEach((feature) => {
191
- const lower = feature.toLowerCase();
192
191
  // Config/setup phase
193
192
  if (/\b(config|configuration|setup|install|package|tsconfig|dependencies|environment)\b/i.test(feature)) {
194
193
  groups['Configuration & Setup'].push(feature);
@@ -291,7 +290,6 @@ export class TaskManager {
291
290
  */
292
291
  buildFeatureTaskDescriptions(feature) {
293
292
  const formattedFeature = this.formatInlineText(feature);
294
- const featureLower = feature.toLowerCase();
295
293
  // Detect task type
296
294
  const isConfig = /\b(config|configuration|setup|install|update.*json|tsconfig|package\.json)\b/i.test(feature);
297
295
  const isTest = /\b(test|testing|coverage|validation|verify)\b/i.test(feature);
@@ -627,6 +625,7 @@ export class TaskManager {
627
625
  const checkbox = task.completed ? '[x]' : '[ ]';
628
626
  const reference = task.prdReference ? ` (ref: ${task.prdReference})` : '';
629
627
  content += `- ${checkbox} ${task.description}${reference}\n`;
628
+ content += ` Task ID: ${task.id}\n`;
630
629
  }
631
630
  content += '\n';
632
631
  }
@@ -653,7 +652,8 @@ export class TaskManager {
653
652
  const lines = content.split('\n');
654
653
  let currentPhase = null;
655
654
  let taskCounter = 0;
656
- for (const line of lines) {
655
+ for (let i = 0; i < lines.length; i++) {
656
+ const line = lines[i];
657
657
  // Check for phase header (## Phase Name)
658
658
  const phaseMatch = line.match(/^##\s+(.+)$/);
659
659
  if (phaseMatch) {
@@ -674,8 +674,21 @@ export class TaskManager {
674
674
  const description = taskMatch[2].trim();
675
675
  const reference = taskMatch[3]?.trim();
676
676
  taskCounter++;
677
+ // Check next line for Task ID
678
+ let taskId;
679
+ const nextLine = i + 1 < lines.length ? lines[i + 1] : null;
680
+ const taskIdMatch = nextLine?.trim().match(/^Task ID:\s+(.+)$/);
681
+ if (taskIdMatch) {
682
+ // Use Task ID from file (preferred)
683
+ taskId = taskIdMatch[1].trim();
684
+ i++; // Skip the Task ID line in next iteration
685
+ }
686
+ else {
687
+ // Fallback: regenerate ID from phase name (backward compatibility)
688
+ taskId = `${this.sanitizeId(currentPhase.name)}-${taskCounter}`;
689
+ }
677
690
  currentPhase.tasks.push({
678
- id: `${this.sanitizeId(currentPhase.name)}-${taskCounter}`,
691
+ id: taskId,
679
692
  description,
680
693
  phase: currentPhase.name,
681
694
  completed,
@@ -12,8 +12,8 @@ Use these instructions when your agent can only read documentation (no slash-com
12
12
  | Command | Purpose |
13
13
  | --- | --- |
14
14
  | `clavix init` | Interactive setup. Select providers and generate documentation/command files. |
15
- | `clavix fast "<prompt>"` | CLEAR (C/L/E) analysis with improved prompt output. CLI auto-saves to `.clavix/outputs/prompts/fast/`. When using slash commands, agent must save manually per template instructions. |
16
- | `clavix deep "<prompt>"` | Full CLEAR (C/L/E/A/R) analysis, alternative variations, validation checklists. CLI auto-saves to `.clavix/outputs/prompts/deep/`. When using slash commands, agent must save manually per template instructions. |
15
+ | `clavix fast "<prompt>"` | Quick prompt optimization with quality assessment (Clarity, Efficiency, Structure, Completeness, Actionability). CLI auto-saves to `.clavix/outputs/prompts/fast/`. When using slash commands, agent must save manually per template instructions. |
16
+ | `clavix deep "<prompt>"` | Comprehensive analysis with alternatives, edge cases, and validation checklists. CLI auto-saves to `.clavix/outputs/prompts/deep/`. When using slash commands, agent must save manually per template instructions. |
17
17
  | `clavix execute [--latest]` | Execute saved prompts from fast/deep optimization. Interactive selection or `--latest` for most recent. |
18
18
  | `clavix prompts list` | View all saved prompts with status (NEW, EXECUTED, OLD, STALE) and storage statistics. |
19
19
  | `clavix prompts clear` | Manage prompt cleanup. Supports `--executed`, `--stale`, `--fast`, `--deep`, `--all` flags. |