clavix 4.3.1 → 4.3.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.
- package/LICENSE +201 -21
- package/README.md +1 -1
- package/dist/core/conversation-quality-tracker.d.ts +81 -0
- package/dist/core/conversation-quality-tracker.js +195 -0
- package/dist/core/intelligence/intent-detector.js +3 -0
- package/dist/core/intelligence/pattern-library.d.ts +18 -1
- package/dist/core/intelligence/pattern-library.js +131 -0
- package/dist/core/intelligence/patterns/conversation-summarizer.d.ts +25 -0
- package/dist/core/intelligence/patterns/conversation-summarizer.js +197 -0
- package/dist/core/intelligence/patterns/dependency-identifier.d.ts +21 -0
- package/dist/core/intelligence/patterns/dependency-identifier.js +149 -0
- package/dist/core/intelligence/patterns/implicit-requirement-extractor.d.ts +20 -0
- package/dist/core/intelligence/patterns/implicit-requirement-extractor.js +129 -0
- package/dist/core/intelligence/patterns/requirement-prioritizer.d.ts +22 -0
- package/dist/core/intelligence/patterns/requirement-prioritizer.js +117 -0
- package/dist/core/intelligence/patterns/success-metrics-enforcer.d.ts +22 -0
- package/dist/core/intelligence/patterns/success-metrics-enforcer.js +142 -0
- package/dist/core/intelligence/patterns/topic-coherence-analyzer.d.ts +22 -0
- package/dist/core/intelligence/patterns/topic-coherence-analyzer.js +140 -0
- package/dist/core/intelligence/patterns/user-persona-enricher.d.ts +22 -0
- package/dist/core/intelligence/patterns/user-persona-enricher.js +124 -0
- package/dist/core/intelligence/quality-assessor.js +2 -0
- package/dist/core/intelligence/types.d.ts +7 -2
- package/dist/core/intelligence/universal-optimizer.d.ts +27 -2
- package/dist/core/intelligence/universal-optimizer.js +65 -5
- package/dist/templates/slash-commands/_canonical/deep.md +1 -0
- package/dist/templates/slash-commands/_canonical/fast.md +1 -0
- package/dist/templates/slash-commands/_components/sections/pattern-visibility.md +26 -2
- package/package.json +2 -2
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { BasePattern } from './base-pattern.js';
|
|
2
|
+
/**
|
|
3
|
+
* v4.3.2 Conversational Pattern: ImplicitRequirementExtractor
|
|
4
|
+
*
|
|
5
|
+
* Surfaces requirements mentioned indirectly in conversations.
|
|
6
|
+
* Identifies hidden assumptions and unstated needs.
|
|
7
|
+
*/
|
|
8
|
+
export class ImplicitRequirementExtractor extends BasePattern {
|
|
9
|
+
id = 'implicit-requirement-extractor';
|
|
10
|
+
name = 'ImplicitRequirementExtractor';
|
|
11
|
+
description = 'Surfaces requirements mentioned indirectly';
|
|
12
|
+
applicableIntents = ['summarization', 'planning', 'prd-generation'];
|
|
13
|
+
mode = 'deep';
|
|
14
|
+
priority = 7;
|
|
15
|
+
apply(prompt, _context) {
|
|
16
|
+
// Extract implicit requirements
|
|
17
|
+
const implicitReqs = this.extractImplicitRequirements(prompt);
|
|
18
|
+
// If no implicit requirements found, skip
|
|
19
|
+
if (implicitReqs.length === 0) {
|
|
20
|
+
return {
|
|
21
|
+
enhancedPrompt: prompt,
|
|
22
|
+
improvement: {
|
|
23
|
+
dimension: 'completeness',
|
|
24
|
+
description: 'No implicit requirements detected',
|
|
25
|
+
impact: 'low',
|
|
26
|
+
},
|
|
27
|
+
applied: false,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
// Add implicit requirements section
|
|
31
|
+
const enhanced = this.addImplicitRequirements(prompt, implicitReqs);
|
|
32
|
+
return {
|
|
33
|
+
enhancedPrompt: enhanced,
|
|
34
|
+
improvement: {
|
|
35
|
+
dimension: 'completeness',
|
|
36
|
+
description: `Surfaced ${implicitReqs.length} implicit requirements`,
|
|
37
|
+
impact: 'medium',
|
|
38
|
+
},
|
|
39
|
+
applied: true,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
extractImplicitRequirements(prompt) {
|
|
43
|
+
const implicitReqs = [];
|
|
44
|
+
const lowerPrompt = prompt.toLowerCase();
|
|
45
|
+
// Pattern 1: "like X" implies feature parity
|
|
46
|
+
const likePatterns = prompt.matchAll(/(?:like|similar to|same as)\s+([A-Za-z0-9\s]+)/gi);
|
|
47
|
+
for (const match of likePatterns) {
|
|
48
|
+
if (match[1]) {
|
|
49
|
+
implicitReqs.push(`Feature parity with "${match[1].trim()}" (implied)`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// Pattern 2: Technical mentions imply requirements
|
|
53
|
+
if (lowerPrompt.includes('mobile')) {
|
|
54
|
+
implicitReqs.push('Mobile-responsive design required');
|
|
55
|
+
}
|
|
56
|
+
if (lowerPrompt.includes('real-time') || lowerPrompt.includes('realtime')) {
|
|
57
|
+
implicitReqs.push('Real-time updates infrastructure needed');
|
|
58
|
+
}
|
|
59
|
+
if (lowerPrompt.includes('scale') ||
|
|
60
|
+
lowerPrompt.includes('thousands') ||
|
|
61
|
+
lowerPrompt.includes('millions')) {
|
|
62
|
+
implicitReqs.push('Scalability architecture required');
|
|
63
|
+
}
|
|
64
|
+
if (lowerPrompt.includes('secure') || lowerPrompt.includes('security')) {
|
|
65
|
+
implicitReqs.push('Security audit and compliance requirements');
|
|
66
|
+
}
|
|
67
|
+
if (lowerPrompt.includes('fast') || lowerPrompt.includes('quick')) {
|
|
68
|
+
implicitReqs.push('Performance optimization requirements');
|
|
69
|
+
}
|
|
70
|
+
// Pattern 3: User mentions imply auth/permissions
|
|
71
|
+
if ((lowerPrompt.includes('user') || lowerPrompt.includes('admin')) &&
|
|
72
|
+
!lowerPrompt.includes('authentication')) {
|
|
73
|
+
implicitReqs.push('User authentication system (implied by user roles)');
|
|
74
|
+
}
|
|
75
|
+
// Pattern 4: Data mentions imply storage
|
|
76
|
+
if ((lowerPrompt.includes('save') ||
|
|
77
|
+
lowerPrompt.includes('store') ||
|
|
78
|
+
lowerPrompt.includes('data')) &&
|
|
79
|
+
!lowerPrompt.includes('database')) {
|
|
80
|
+
implicitReqs.push('Data persistence/storage (implied by data operations)');
|
|
81
|
+
}
|
|
82
|
+
// Pattern 5: "Easy" or "simple" implies UX focus
|
|
83
|
+
if (lowerPrompt.includes('easy') ||
|
|
84
|
+
lowerPrompt.includes('simple') ||
|
|
85
|
+
lowerPrompt.includes('intuitive')) {
|
|
86
|
+
implicitReqs.push('User experience priority (simplicity mentioned)');
|
|
87
|
+
}
|
|
88
|
+
// Pattern 6: Notifications/alerts imply communication system
|
|
89
|
+
if (lowerPrompt.includes('notify') ||
|
|
90
|
+
lowerPrompt.includes('alert') ||
|
|
91
|
+
lowerPrompt.includes('email') ||
|
|
92
|
+
lowerPrompt.includes('notification')) {
|
|
93
|
+
implicitReqs.push('Notification system infrastructure');
|
|
94
|
+
}
|
|
95
|
+
// Pattern 7: Search implies search infrastructure
|
|
96
|
+
if (lowerPrompt.includes('search') || lowerPrompt.includes('find')) {
|
|
97
|
+
implicitReqs.push('Search functionality and indexing');
|
|
98
|
+
}
|
|
99
|
+
// Pattern 8: Reports/analytics implies data aggregation
|
|
100
|
+
if (lowerPrompt.includes('report') ||
|
|
101
|
+
lowerPrompt.includes('analytics') ||
|
|
102
|
+
lowerPrompt.includes('dashboard')) {
|
|
103
|
+
implicitReqs.push('Analytics and reporting infrastructure');
|
|
104
|
+
}
|
|
105
|
+
// Pattern 9: Integration mentions
|
|
106
|
+
if (lowerPrompt.includes('integrate') ||
|
|
107
|
+
lowerPrompt.includes('connect') ||
|
|
108
|
+
lowerPrompt.includes('sync')) {
|
|
109
|
+
implicitReqs.push('Integration APIs and webhooks');
|
|
110
|
+
}
|
|
111
|
+
// Pattern 10: "Always" or "never" implies validation rules
|
|
112
|
+
const alwaysNeverPatterns = prompt.matchAll(/(?:always|never|must always|must never)\s+([^.!?]+)/gi);
|
|
113
|
+
for (const match of alwaysNeverPatterns) {
|
|
114
|
+
if (match[1]) {
|
|
115
|
+
implicitReqs.push(`Business rule: "${match[1].trim()}" (implied constraint)`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// Deduplicate
|
|
119
|
+
return [...new Set(implicitReqs)].slice(0, 8);
|
|
120
|
+
}
|
|
121
|
+
addImplicitRequirements(prompt, implicitReqs) {
|
|
122
|
+
let section = '\n\n### Implicit Requirements (Inferred)\n';
|
|
123
|
+
section += '*The following requirements are implied by the discussion:*\n\n';
|
|
124
|
+
section += implicitReqs.map((r) => `- ${r}`).join('\n');
|
|
125
|
+
section += '\n\n> **Note:** Please verify these inferred requirements are accurate.';
|
|
126
|
+
return prompt + section;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=implicit-requirement-extractor.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BasePattern } from './base-pattern.js';
|
|
2
|
+
import { PromptIntent, OptimizationMode, PatternContext, PatternResult } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* v4.3.2 PRD Pattern: RequirementPrioritizer
|
|
5
|
+
*
|
|
6
|
+
* Separates must-have from nice-to-have requirements in PRD content.
|
|
7
|
+
* Helps clarify priorities and MVP scope.
|
|
8
|
+
*/
|
|
9
|
+
export declare class RequirementPrioritizer extends BasePattern {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
applicableIntents: PromptIntent[];
|
|
14
|
+
mode: OptimizationMode | 'both';
|
|
15
|
+
priority: number;
|
|
16
|
+
apply(prompt: string, _context: PatternContext): PatternResult;
|
|
17
|
+
private hasFeatureContent;
|
|
18
|
+
private hasPrioritization;
|
|
19
|
+
private addPrioritization;
|
|
20
|
+
private extractFeatureSection;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=requirement-prioritizer.d.ts.map
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { BasePattern } from './base-pattern.js';
|
|
2
|
+
/**
|
|
3
|
+
* v4.3.2 PRD Pattern: RequirementPrioritizer
|
|
4
|
+
*
|
|
5
|
+
* Separates must-have from nice-to-have requirements in PRD content.
|
|
6
|
+
* Helps clarify priorities and MVP scope.
|
|
7
|
+
*/
|
|
8
|
+
export class RequirementPrioritizer extends BasePattern {
|
|
9
|
+
id = 'requirement-prioritizer';
|
|
10
|
+
name = 'RequirementPrioritizer';
|
|
11
|
+
description = 'Separates must-have from nice-to-have requirements';
|
|
12
|
+
applicableIntents = ['prd-generation', 'planning'];
|
|
13
|
+
mode = 'deep';
|
|
14
|
+
priority = 7;
|
|
15
|
+
apply(prompt, _context) {
|
|
16
|
+
// Only apply to PRD-related content with features
|
|
17
|
+
if (!this.hasFeatureContent(prompt)) {
|
|
18
|
+
return {
|
|
19
|
+
enhancedPrompt: prompt,
|
|
20
|
+
improvement: {
|
|
21
|
+
dimension: 'structure',
|
|
22
|
+
description: 'No feature content to prioritize',
|
|
23
|
+
impact: 'low',
|
|
24
|
+
},
|
|
25
|
+
applied: false,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
// Check if prioritization already exists
|
|
29
|
+
if (this.hasPrioritization(prompt)) {
|
|
30
|
+
return {
|
|
31
|
+
enhancedPrompt: prompt,
|
|
32
|
+
improvement: {
|
|
33
|
+
dimension: 'structure',
|
|
34
|
+
description: 'Requirements already prioritized',
|
|
35
|
+
impact: 'low',
|
|
36
|
+
},
|
|
37
|
+
applied: false,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
// Add prioritization framework
|
|
41
|
+
const enhanced = this.addPrioritization(prompt);
|
|
42
|
+
return {
|
|
43
|
+
enhancedPrompt: enhanced,
|
|
44
|
+
improvement: {
|
|
45
|
+
dimension: 'structure',
|
|
46
|
+
description: 'Added requirement prioritization (must-have vs nice-to-have)',
|
|
47
|
+
impact: 'high',
|
|
48
|
+
},
|
|
49
|
+
applied: true,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
hasFeatureContent(prompt) {
|
|
53
|
+
const featureKeywords = [
|
|
54
|
+
'feature',
|
|
55
|
+
'requirement',
|
|
56
|
+
'functionality',
|
|
57
|
+
'capability',
|
|
58
|
+
'should',
|
|
59
|
+
'must',
|
|
60
|
+
'need',
|
|
61
|
+
'want',
|
|
62
|
+
'implement',
|
|
63
|
+
];
|
|
64
|
+
return this.hasSection(prompt, featureKeywords);
|
|
65
|
+
}
|
|
66
|
+
hasPrioritization(prompt) {
|
|
67
|
+
const priorityKeywords = [
|
|
68
|
+
'must-have',
|
|
69
|
+
'must have',
|
|
70
|
+
'nice-to-have',
|
|
71
|
+
'nice to have',
|
|
72
|
+
'p0',
|
|
73
|
+
'p1',
|
|
74
|
+
'p2',
|
|
75
|
+
'priority:',
|
|
76
|
+
'mvp',
|
|
77
|
+
'phase 1',
|
|
78
|
+
'phase 2',
|
|
79
|
+
'critical',
|
|
80
|
+
'optional',
|
|
81
|
+
];
|
|
82
|
+
return this.hasSection(prompt, priorityKeywords);
|
|
83
|
+
}
|
|
84
|
+
addPrioritization(prompt) {
|
|
85
|
+
// Look for feature sections and add prioritization guidance
|
|
86
|
+
const featureSection = this.extractFeatureSection(prompt);
|
|
87
|
+
if (!featureSection) {
|
|
88
|
+
// No clear feature section, add prioritization note
|
|
89
|
+
return (prompt +
|
|
90
|
+
'\n\n### Requirement Priorities\n' +
|
|
91
|
+
'**Must-Have (MVP):**\n- [Core features required for launch]\n\n' +
|
|
92
|
+
'**Nice-to-Have (Post-MVP):**\n- [Features to add after initial release]');
|
|
93
|
+
}
|
|
94
|
+
// Features exist but aren't prioritized - add framework
|
|
95
|
+
const priorityNote = '\n\n> **Priority Framework:** Consider categorizing features as:\n' +
|
|
96
|
+
'> - **Must-Have (P0):** Required for MVP, blocking issues\n' +
|
|
97
|
+
'> - **Should-Have (P1):** Important but not blocking\n' +
|
|
98
|
+
'> - **Nice-to-Have (P2):** Enhancements for future iterations';
|
|
99
|
+
return prompt + priorityNote;
|
|
100
|
+
}
|
|
101
|
+
extractFeatureSection(prompt) {
|
|
102
|
+
// Try to find feature-related sections
|
|
103
|
+
const featurePatterns = [
|
|
104
|
+
/features?:?\s*\n([\s\S]*?)(?=\n##|\n\*\*[A-Z]|$)/i,
|
|
105
|
+
/requirements?:?\s*\n([\s\S]*?)(?=\n##|\n\*\*[A-Z]|$)/i,
|
|
106
|
+
/what we(?:'re| are) building:?\s*\n([\s\S]*?)(?=\n##|\n\*\*[A-Z]|$)/i,
|
|
107
|
+
];
|
|
108
|
+
for (const pattern of featurePatterns) {
|
|
109
|
+
const match = prompt.match(pattern);
|
|
110
|
+
if (match) {
|
|
111
|
+
return match[1];
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=requirement-prioritizer.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BasePattern } from './base-pattern.js';
|
|
2
|
+
import { PromptIntent, OptimizationMode, PatternContext, PatternResult } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* v4.3.2 PRD Pattern: SuccessMetricsEnforcer
|
|
5
|
+
*
|
|
6
|
+
* Ensures measurable success criteria exist in PRD content.
|
|
7
|
+
* Adds KPIs and metrics when missing.
|
|
8
|
+
*/
|
|
9
|
+
export declare class SuccessMetricsEnforcer extends BasePattern {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
applicableIntents: PromptIntent[];
|
|
14
|
+
mode: OptimizationMode | 'both';
|
|
15
|
+
priority: number;
|
|
16
|
+
apply(prompt: string, _context: PatternContext): PatternResult;
|
|
17
|
+
private hasSuccessMetrics;
|
|
18
|
+
private needsMetrics;
|
|
19
|
+
private addSuccessMetrics;
|
|
20
|
+
private inferRelevantMetrics;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=success-metrics-enforcer.d.ts.map
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { BasePattern } from './base-pattern.js';
|
|
2
|
+
/**
|
|
3
|
+
* v4.3.2 PRD Pattern: SuccessMetricsEnforcer
|
|
4
|
+
*
|
|
5
|
+
* Ensures measurable success criteria exist in PRD content.
|
|
6
|
+
* Adds KPIs and metrics when missing.
|
|
7
|
+
*/
|
|
8
|
+
export class SuccessMetricsEnforcer extends BasePattern {
|
|
9
|
+
id = 'success-metrics-enforcer';
|
|
10
|
+
name = 'SuccessMetricsEnforcer';
|
|
11
|
+
description = 'Ensures measurable success criteria exist';
|
|
12
|
+
applicableIntents = ['prd-generation', 'planning'];
|
|
13
|
+
mode = 'deep';
|
|
14
|
+
priority = 7;
|
|
15
|
+
apply(prompt, _context) {
|
|
16
|
+
// Check if success metrics already exist
|
|
17
|
+
if (this.hasSuccessMetrics(prompt)) {
|
|
18
|
+
return {
|
|
19
|
+
enhancedPrompt: prompt,
|
|
20
|
+
improvement: {
|
|
21
|
+
dimension: 'completeness',
|
|
22
|
+
description: 'Success metrics already present',
|
|
23
|
+
impact: 'low',
|
|
24
|
+
},
|
|
25
|
+
applied: false,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
// Check if this is content that needs metrics
|
|
29
|
+
if (!this.needsMetrics(prompt)) {
|
|
30
|
+
return {
|
|
31
|
+
enhancedPrompt: prompt,
|
|
32
|
+
improvement: {
|
|
33
|
+
dimension: 'completeness',
|
|
34
|
+
description: 'Content does not require success metrics',
|
|
35
|
+
impact: 'low',
|
|
36
|
+
},
|
|
37
|
+
applied: false,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
// Add success metrics section
|
|
41
|
+
const enhanced = this.addSuccessMetrics(prompt);
|
|
42
|
+
return {
|
|
43
|
+
enhancedPrompt: enhanced,
|
|
44
|
+
improvement: {
|
|
45
|
+
dimension: 'completeness',
|
|
46
|
+
description: 'Added measurable success criteria and KPIs',
|
|
47
|
+
impact: 'high',
|
|
48
|
+
},
|
|
49
|
+
applied: true,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
hasSuccessMetrics(prompt) {
|
|
53
|
+
const metricsKeywords = [
|
|
54
|
+
'success metric',
|
|
55
|
+
'success criteria',
|
|
56
|
+
'kpi',
|
|
57
|
+
'measure success',
|
|
58
|
+
'acceptance criteria',
|
|
59
|
+
'% increase',
|
|
60
|
+
'% decrease',
|
|
61
|
+
'conversion rate',
|
|
62
|
+
'completion rate',
|
|
63
|
+
'response time',
|
|
64
|
+
'latency',
|
|
65
|
+
'uptime',
|
|
66
|
+
'sla',
|
|
67
|
+
'benchmark',
|
|
68
|
+
];
|
|
69
|
+
return this.hasSection(prompt, metricsKeywords);
|
|
70
|
+
}
|
|
71
|
+
needsMetrics(prompt) {
|
|
72
|
+
// PRD-like content that describes features
|
|
73
|
+
const prdKeywords = [
|
|
74
|
+
'feature',
|
|
75
|
+
'build',
|
|
76
|
+
'implement',
|
|
77
|
+
'goal',
|
|
78
|
+
'objective',
|
|
79
|
+
'product',
|
|
80
|
+
'launch',
|
|
81
|
+
'release',
|
|
82
|
+
];
|
|
83
|
+
return this.hasSection(prompt, prdKeywords);
|
|
84
|
+
}
|
|
85
|
+
addSuccessMetrics(prompt) {
|
|
86
|
+
// Detect the type of project to suggest relevant metrics
|
|
87
|
+
const metrics = this.inferRelevantMetrics(prompt);
|
|
88
|
+
const metricsSection = `\n\n### Success Metrics\n` +
|
|
89
|
+
`**Primary KPIs:**\n` +
|
|
90
|
+
metrics.map((m) => `- ${m}`).join('\n') +
|
|
91
|
+
`\n\n**Measurement Approach:**\n` +
|
|
92
|
+
`- Baseline: [Current state before implementation]\n` +
|
|
93
|
+
`- Target: [Specific, measurable goals]\n` +
|
|
94
|
+
`- Timeline: [When to measure success]`;
|
|
95
|
+
return prompt + metricsSection;
|
|
96
|
+
}
|
|
97
|
+
inferRelevantMetrics(prompt) {
|
|
98
|
+
const lowerPrompt = prompt.toLowerCase();
|
|
99
|
+
const metrics = [];
|
|
100
|
+
// Performance-related
|
|
101
|
+
if (lowerPrompt.includes('performance') ||
|
|
102
|
+
lowerPrompt.includes('fast') ||
|
|
103
|
+
lowerPrompt.includes('speed')) {
|
|
104
|
+
metrics.push('Response time < [X]ms (p95)');
|
|
105
|
+
metrics.push('Page load time improvement by [X]%');
|
|
106
|
+
}
|
|
107
|
+
// User engagement
|
|
108
|
+
if (lowerPrompt.includes('user') ||
|
|
109
|
+
lowerPrompt.includes('engagement') ||
|
|
110
|
+
lowerPrompt.includes('retention')) {
|
|
111
|
+
metrics.push('User engagement increase by [X]%');
|
|
112
|
+
metrics.push('Task completion rate > [X]%');
|
|
113
|
+
}
|
|
114
|
+
// Conversion/business
|
|
115
|
+
if (lowerPrompt.includes('conversion') ||
|
|
116
|
+
lowerPrompt.includes('sales') ||
|
|
117
|
+
lowerPrompt.includes('revenue')) {
|
|
118
|
+
metrics.push('Conversion rate improvement by [X]%');
|
|
119
|
+
metrics.push('Revenue impact of $[X]');
|
|
120
|
+
}
|
|
121
|
+
// Technical quality
|
|
122
|
+
if (lowerPrompt.includes('quality') ||
|
|
123
|
+
lowerPrompt.includes('bug') ||
|
|
124
|
+
lowerPrompt.includes('error')) {
|
|
125
|
+
metrics.push('Error rate < [X]%');
|
|
126
|
+
metrics.push('Test coverage > [X]%');
|
|
127
|
+
}
|
|
128
|
+
// API/integration
|
|
129
|
+
if (lowerPrompt.includes('api') || lowerPrompt.includes('integration')) {
|
|
130
|
+
metrics.push('API availability > [X]%');
|
|
131
|
+
metrics.push('Integration success rate > [X]%');
|
|
132
|
+
}
|
|
133
|
+
// Default metrics if none matched
|
|
134
|
+
if (metrics.length === 0) {
|
|
135
|
+
metrics.push('[Define primary success metric]');
|
|
136
|
+
metrics.push('[Define secondary success metric]');
|
|
137
|
+
metrics.push('[Define timeline for measurement]');
|
|
138
|
+
}
|
|
139
|
+
return metrics.slice(0, 4); // Max 4 metrics
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=success-metrics-enforcer.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BasePattern } from './base-pattern.js';
|
|
2
|
+
import { PromptIntent, OptimizationMode, PatternContext, PatternResult } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* v4.3.2 Conversational Pattern: TopicCoherenceAnalyzer
|
|
5
|
+
*
|
|
6
|
+
* Detects topic shifts and multi-topic conversations.
|
|
7
|
+
* Helps organize scattered discussions into coherent themes.
|
|
8
|
+
*/
|
|
9
|
+
export declare class TopicCoherenceAnalyzer extends BasePattern {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
applicableIntents: PromptIntent[];
|
|
14
|
+
mode: OptimizationMode | 'both';
|
|
15
|
+
priority: number;
|
|
16
|
+
apply(prompt: string, _context: PatternContext): PatternResult;
|
|
17
|
+
private detectTopics;
|
|
18
|
+
private hasTopicOrganization;
|
|
19
|
+
private organizeByTopic;
|
|
20
|
+
private extractTopicContent;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=topic-coherence-analyzer.d.ts.map
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { BasePattern } from './base-pattern.js';
|
|
2
|
+
/**
|
|
3
|
+
* v4.3.2 Conversational Pattern: TopicCoherenceAnalyzer
|
|
4
|
+
*
|
|
5
|
+
* Detects topic shifts and multi-topic conversations.
|
|
6
|
+
* Helps organize scattered discussions into coherent themes.
|
|
7
|
+
*/
|
|
8
|
+
export class TopicCoherenceAnalyzer extends BasePattern {
|
|
9
|
+
id = 'topic-coherence-analyzer';
|
|
10
|
+
name = 'TopicCoherenceAnalyzer';
|
|
11
|
+
description = 'Detects topic shifts and multi-topic conversations';
|
|
12
|
+
applicableIntents = ['summarization', 'planning'];
|
|
13
|
+
mode = 'deep';
|
|
14
|
+
priority = 6;
|
|
15
|
+
apply(prompt, _context) {
|
|
16
|
+
// Detect topics in the content
|
|
17
|
+
const topics = this.detectTopics(prompt);
|
|
18
|
+
// If single topic or already organized, skip
|
|
19
|
+
if (topics.length <= 1) {
|
|
20
|
+
return {
|
|
21
|
+
enhancedPrompt: prompt,
|
|
22
|
+
improvement: {
|
|
23
|
+
dimension: 'structure',
|
|
24
|
+
description: 'Single coherent topic detected',
|
|
25
|
+
impact: 'low',
|
|
26
|
+
},
|
|
27
|
+
applied: false,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
// Check if already has topic organization
|
|
31
|
+
if (this.hasTopicOrganization(prompt)) {
|
|
32
|
+
return {
|
|
33
|
+
enhancedPrompt: prompt,
|
|
34
|
+
improvement: {
|
|
35
|
+
dimension: 'structure',
|
|
36
|
+
description: 'Topics already organized',
|
|
37
|
+
impact: 'low',
|
|
38
|
+
},
|
|
39
|
+
applied: false,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
// Add topic organization
|
|
43
|
+
const enhanced = this.organizeByTopic(prompt, topics);
|
|
44
|
+
return {
|
|
45
|
+
enhancedPrompt: enhanced,
|
|
46
|
+
improvement: {
|
|
47
|
+
dimension: 'structure',
|
|
48
|
+
description: `Organized ${topics.length} distinct topics for clarity`,
|
|
49
|
+
impact: 'medium',
|
|
50
|
+
},
|
|
51
|
+
applied: true,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
detectTopics(prompt) {
|
|
55
|
+
const topics = [];
|
|
56
|
+
const lowerPrompt = prompt.toLowerCase();
|
|
57
|
+
// Topic detection patterns
|
|
58
|
+
const topicIndicators = {
|
|
59
|
+
'User Interface': ['ui', 'interface', 'design', 'layout', 'button', 'form', 'page', 'screen'],
|
|
60
|
+
'Backend/API': ['api', 'backend', 'server', 'endpoint', 'route', 'controller'],
|
|
61
|
+
Database: ['database', 'db', 'schema', 'table', 'query', 'migration'],
|
|
62
|
+
Authentication: ['auth', 'login', 'password', 'session', 'token', 'permission'],
|
|
63
|
+
Performance: ['performance', 'speed', 'cache', 'optimize', 'latency'],
|
|
64
|
+
Testing: ['test', 'spec', 'coverage', 'qa', 'validation'],
|
|
65
|
+
Deployment: ['deploy', 'ci/cd', 'pipeline', 'release', 'environment'],
|
|
66
|
+
'User Experience': ['ux', 'usability', 'accessibility', 'user flow', 'journey'],
|
|
67
|
+
'Business Logic': ['business', 'workflow', 'process', 'rule', 'logic'],
|
|
68
|
+
Integration: ['integration', 'third-party', 'external', 'webhook', 'sync'],
|
|
69
|
+
};
|
|
70
|
+
for (const [topic, keywords] of Object.entries(topicIndicators)) {
|
|
71
|
+
const hasKeyword = keywords.some((kw) => lowerPrompt.includes(kw));
|
|
72
|
+
if (hasKeyword) {
|
|
73
|
+
topics.push(topic);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return topics;
|
|
77
|
+
}
|
|
78
|
+
hasTopicOrganization(prompt) {
|
|
79
|
+
// Check for existing topic headers
|
|
80
|
+
const topicHeaders = /##\s*(user interface|backend|database|auth|performance|testing|deploy)/i;
|
|
81
|
+
return topicHeaders.test(prompt);
|
|
82
|
+
}
|
|
83
|
+
organizeByTopic(prompt, topics) {
|
|
84
|
+
// Add topic summary at the beginning
|
|
85
|
+
let organized = '### Topics Covered\n';
|
|
86
|
+
organized += 'This conversation touches on multiple areas:\n';
|
|
87
|
+
organized += topics.map((t, i) => `${i + 1}. **${t}**`).join('\n');
|
|
88
|
+
organized += '\n\n---\n\n';
|
|
89
|
+
// Extract content relevant to each topic
|
|
90
|
+
organized += '### Discussion by Topic\n\n';
|
|
91
|
+
for (const topic of topics) {
|
|
92
|
+
const relevantContent = this.extractTopicContent(prompt, topic);
|
|
93
|
+
if (relevantContent) {
|
|
94
|
+
organized += `#### ${topic}\n`;
|
|
95
|
+
organized += relevantContent + '\n\n';
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
organized += '---\n\n**Full Context:**\n' + prompt;
|
|
99
|
+
return organized;
|
|
100
|
+
}
|
|
101
|
+
extractTopicContent(prompt, topic) {
|
|
102
|
+
// Simple extraction based on topic keywords
|
|
103
|
+
const topicKeywords = {
|
|
104
|
+
'User Interface': [
|
|
105
|
+
'ui',
|
|
106
|
+
'interface',
|
|
107
|
+
'design',
|
|
108
|
+
'layout',
|
|
109
|
+
'button',
|
|
110
|
+
'form',
|
|
111
|
+
'page',
|
|
112
|
+
'screen',
|
|
113
|
+
'component',
|
|
114
|
+
],
|
|
115
|
+
'Backend/API': ['api', 'backend', 'server', 'endpoint', 'route', 'controller', 'service'],
|
|
116
|
+
Database: ['database', 'db', 'schema', 'table', 'query', 'migration', 'model'],
|
|
117
|
+
Authentication: ['auth', 'login', 'password', 'session', 'token', 'permission', 'user'],
|
|
118
|
+
Performance: ['performance', 'speed', 'cache', 'optimize', 'latency', 'fast', 'slow'],
|
|
119
|
+
Testing: ['test', 'spec', 'coverage', 'qa', 'validation', 'verify'],
|
|
120
|
+
Deployment: ['deploy', 'ci/cd', 'pipeline', 'release', 'environment', 'production'],
|
|
121
|
+
'User Experience': ['ux', 'usability', 'accessibility', 'user flow', 'journey', 'experience'],
|
|
122
|
+
'Business Logic': ['business', 'workflow', 'process', 'rule', 'logic', 'requirement'],
|
|
123
|
+
Integration: ['integration', 'third-party', 'external', 'webhook', 'sync', 'connect'],
|
|
124
|
+
};
|
|
125
|
+
const keywords = topicKeywords[topic] || [];
|
|
126
|
+
const sentences = this.extractSentences(prompt);
|
|
127
|
+
const relevantSentences = sentences.filter((sentence) => {
|
|
128
|
+
const lower = sentence.toLowerCase();
|
|
129
|
+
return keywords.some((kw) => lower.includes(kw));
|
|
130
|
+
});
|
|
131
|
+
if (relevantSentences.length === 0) {
|
|
132
|
+
return `- Discussion related to ${topic}`;
|
|
133
|
+
}
|
|
134
|
+
return relevantSentences
|
|
135
|
+
.slice(0, 3)
|
|
136
|
+
.map((s) => `- ${s.trim()}`)
|
|
137
|
+
.join('\n');
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=topic-coherence-analyzer.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BasePattern } from './base-pattern.js';
|
|
2
|
+
import { PromptIntent, OptimizationMode, PatternContext, PatternResult } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* v4.3.2 PRD Pattern: UserPersonaEnricher
|
|
5
|
+
*
|
|
6
|
+
* Adds missing user context and personas to PRD content.
|
|
7
|
+
* Ensures the "who" is clearly defined alongside the "what".
|
|
8
|
+
*/
|
|
9
|
+
export declare class UserPersonaEnricher extends BasePattern {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
applicableIntents: PromptIntent[];
|
|
14
|
+
mode: OptimizationMode | 'both';
|
|
15
|
+
priority: number;
|
|
16
|
+
apply(prompt: string, _context: PatternContext): PatternResult;
|
|
17
|
+
private hasUserContext;
|
|
18
|
+
private needsUserContext;
|
|
19
|
+
private addUserPersona;
|
|
20
|
+
private inferUserType;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=user-persona-enricher.d.ts.map
|