clavix 4.12.0 → 5.0.0

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 (151) hide show
  1. package/README.md +69 -61
  2. package/dist/templates/slash-commands/_canonical/archive.md +83 -121
  3. package/dist/templates/slash-commands/_canonical/execute.md +32 -42
  4. package/dist/templates/slash-commands/_canonical/implement.md +32 -44
  5. package/dist/templates/slash-commands/_canonical/improve.md +13 -52
  6. package/dist/templates/slash-commands/_components/agent-protocols/cli-reference.md +84 -180
  7. package/dist/templates/slash-commands/_components/agent-protocols/error-handling.md +2 -2
  8. package/dist/templates/slash-commands/_components/agent-protocols/file-formats.md +41 -59
  9. package/dist/templates/slash-commands/_components/sections/file-saving-protocol.md +20 -27
  10. package/dist/templates/slash-commands/_components/troubleshooting/file-not-saved.md +4 -5
  11. package/package.json +2 -2
  12. package/dist/cli/commands/analyze.d.ts +0 -17
  13. package/dist/cli/commands/analyze.js +0 -133
  14. package/dist/cli/commands/archive.d.ts +0 -36
  15. package/dist/cli/commands/archive.js +0 -266
  16. package/dist/cli/commands/deep.d.ts +0 -17
  17. package/dist/cli/commands/deep.js +0 -170
  18. package/dist/cli/commands/execute.d.ts +0 -15
  19. package/dist/cli/commands/execute.js +0 -168
  20. package/dist/cli/commands/fast.d.ts +0 -18
  21. package/dist/cli/commands/fast.js +0 -219
  22. package/dist/cli/commands/implement.d.ts +0 -24
  23. package/dist/cli/commands/implement.js +0 -289
  24. package/dist/cli/commands/improve.d.ts +0 -32
  25. package/dist/cli/commands/improve.js +0 -250
  26. package/dist/cli/commands/list.d.ts +0 -17
  27. package/dist/cli/commands/list.js +0 -217
  28. package/dist/cli/commands/plan.d.ts +0 -21
  29. package/dist/cli/commands/plan.js +0 -297
  30. package/dist/cli/commands/prd.d.ts +0 -24
  31. package/dist/cli/commands/prd.js +0 -321
  32. package/dist/cli/commands/prompts/clear.d.ts +0 -16
  33. package/dist/cli/commands/prompts/clear.js +0 -222
  34. package/dist/cli/commands/prompts/list.d.ts +0 -8
  35. package/dist/cli/commands/prompts/list.js +0 -88
  36. package/dist/cli/commands/show.d.ts +0 -21
  37. package/dist/cli/commands/show.js +0 -191
  38. package/dist/cli/commands/start.d.ts +0 -40
  39. package/dist/cli/commands/start.js +0 -210
  40. package/dist/cli/commands/summarize.d.ts +0 -17
  41. package/dist/cli/commands/summarize.js +0 -196
  42. package/dist/cli/commands/task-complete.d.ts +0 -27
  43. package/dist/cli/commands/task-complete.js +0 -269
  44. package/dist/cli/commands/verify.d.ts +0 -28
  45. package/dist/cli/commands/verify.js +0 -349
  46. package/dist/core/archive-manager.d.ts +0 -100
  47. package/dist/core/archive-manager.js +0 -302
  48. package/dist/core/basic-checklist-generator.d.ts +0 -35
  49. package/dist/core/basic-checklist-generator.js +0 -344
  50. package/dist/core/checklist-parser.d.ts +0 -48
  51. package/dist/core/checklist-parser.js +0 -238
  52. package/dist/core/config-manager.d.ts +0 -149
  53. package/dist/core/config-manager.js +0 -230
  54. package/dist/core/conversation-analyzer.d.ts +0 -86
  55. package/dist/core/conversation-analyzer.js +0 -387
  56. package/dist/core/conversation-quality-tracker.d.ts +0 -81
  57. package/dist/core/conversation-quality-tracker.js +0 -195
  58. package/dist/core/git-manager.d.ts +0 -126
  59. package/dist/core/git-manager.js +0 -282
  60. package/dist/core/intelligence/confidence-calculator.d.ts +0 -93
  61. package/dist/core/intelligence/confidence-calculator.js +0 -124
  62. package/dist/core/intelligence/index.d.ts +0 -11
  63. package/dist/core/intelligence/index.js +0 -15
  64. package/dist/core/intelligence/intent-detector.d.ts +0 -54
  65. package/dist/core/intelligence/intent-detector.js +0 -723
  66. package/dist/core/intelligence/pattern-library.d.ts +0 -104
  67. package/dist/core/intelligence/pattern-library.js +0 -330
  68. package/dist/core/intelligence/patterns/actionability-enhancer.d.ts +0 -27
  69. package/dist/core/intelligence/patterns/actionability-enhancer.js +0 -192
  70. package/dist/core/intelligence/patterns/alternative-phrasing-generator.d.ts +0 -29
  71. package/dist/core/intelligence/patterns/alternative-phrasing-generator.js +0 -239
  72. package/dist/core/intelligence/patterns/ambiguity-detector.d.ts +0 -22
  73. package/dist/core/intelligence/patterns/ambiguity-detector.js +0 -196
  74. package/dist/core/intelligence/patterns/assumption-explicitizer.d.ts +0 -30
  75. package/dist/core/intelligence/patterns/assumption-explicitizer.js +0 -296
  76. package/dist/core/intelligence/patterns/base-pattern.d.ts +0 -192
  77. package/dist/core/intelligence/patterns/base-pattern.js +0 -103
  78. package/dist/core/intelligence/patterns/completeness-validator.d.ts +0 -27
  79. package/dist/core/intelligence/patterns/completeness-validator.js +0 -221
  80. package/dist/core/intelligence/patterns/conciseness-filter.d.ts +0 -20
  81. package/dist/core/intelligence/patterns/conciseness-filter.js +0 -92
  82. package/dist/core/intelligence/patterns/context-precision.d.ts +0 -32
  83. package/dist/core/intelligence/patterns/context-precision.js +0 -389
  84. package/dist/core/intelligence/patterns/conversation-summarizer.d.ts +0 -30
  85. package/dist/core/intelligence/patterns/conversation-summarizer.js +0 -277
  86. package/dist/core/intelligence/patterns/dependency-identifier.d.ts +0 -23
  87. package/dist/core/intelligence/patterns/dependency-identifier.js +0 -166
  88. package/dist/core/intelligence/patterns/domain-context-enricher.d.ts +0 -21
  89. package/dist/core/intelligence/patterns/domain-context-enricher.js +0 -198
  90. package/dist/core/intelligence/patterns/edge-case-identifier.d.ts +0 -30
  91. package/dist/core/intelligence/patterns/edge-case-identifier.js +0 -269
  92. package/dist/core/intelligence/patterns/error-tolerance-enhancer.d.ts +0 -22
  93. package/dist/core/intelligence/patterns/error-tolerance-enhancer.js +0 -179
  94. package/dist/core/intelligence/patterns/implicit-requirement-extractor.d.ts +0 -24
  95. package/dist/core/intelligence/patterns/implicit-requirement-extractor.js +0 -259
  96. package/dist/core/intelligence/patterns/objective-clarifier.d.ts +0 -22
  97. package/dist/core/intelligence/patterns/objective-clarifier.js +0 -126
  98. package/dist/core/intelligence/patterns/output-format-enforcer.d.ts +0 -22
  99. package/dist/core/intelligence/patterns/output-format-enforcer.js +0 -151
  100. package/dist/core/intelligence/patterns/prd-structure-enforcer.d.ts +0 -23
  101. package/dist/core/intelligence/patterns/prd-structure-enforcer.js +0 -183
  102. package/dist/core/intelligence/patterns/prerequisite-identifier.d.ts +0 -23
  103. package/dist/core/intelligence/patterns/prerequisite-identifier.js +0 -221
  104. package/dist/core/intelligence/patterns/requirement-prioritizer.d.ts +0 -24
  105. package/dist/core/intelligence/patterns/requirement-prioritizer.js +0 -134
  106. package/dist/core/intelligence/patterns/scope-definer.d.ts +0 -26
  107. package/dist/core/intelligence/patterns/scope-definer.js +0 -236
  108. package/dist/core/intelligence/patterns/step-decomposer.d.ts +0 -31
  109. package/dist/core/intelligence/patterns/step-decomposer.js +0 -242
  110. package/dist/core/intelligence/patterns/structure-organizer.d.ts +0 -31
  111. package/dist/core/intelligence/patterns/structure-organizer.js +0 -218
  112. package/dist/core/intelligence/patterns/success-criteria-enforcer.d.ts +0 -22
  113. package/dist/core/intelligence/patterns/success-criteria-enforcer.js +0 -165
  114. package/dist/core/intelligence/patterns/success-metrics-enforcer.d.ts +0 -24
  115. package/dist/core/intelligence/patterns/success-metrics-enforcer.js +0 -165
  116. package/dist/core/intelligence/patterns/technical-context-enricher.d.ts +0 -25
  117. package/dist/core/intelligence/patterns/technical-context-enricher.js +0 -165
  118. package/dist/core/intelligence/patterns/topic-coherence-analyzer.d.ts +0 -26
  119. package/dist/core/intelligence/patterns/topic-coherence-analyzer.js +0 -300
  120. package/dist/core/intelligence/patterns/user-persona-enricher.d.ts +0 -24
  121. package/dist/core/intelligence/patterns/user-persona-enricher.js +0 -141
  122. package/dist/core/intelligence/patterns/validation-checklist-creator.d.ts +0 -31
  123. package/dist/core/intelligence/patterns/validation-checklist-creator.js +0 -242
  124. package/dist/core/intelligence/quality-assessor.d.ts +0 -71
  125. package/dist/core/intelligence/quality-assessor.js +0 -525
  126. package/dist/core/intelligence/types.d.ts +0 -111
  127. package/dist/core/intelligence/types.js +0 -3
  128. package/dist/core/intelligence/universal-optimizer.d.ts +0 -91
  129. package/dist/core/intelligence/universal-optimizer.js +0 -399
  130. package/dist/core/prd-generator.d.ts +0 -76
  131. package/dist/core/prd-generator.js +0 -173
  132. package/dist/core/prompt-manager.d.ts +0 -110
  133. package/dist/core/prompt-manager.js +0 -274
  134. package/dist/core/prompt-optimizer.d.ts +0 -268
  135. package/dist/core/prompt-optimizer.js +0 -959
  136. package/dist/core/question-engine.d.ts +0 -167
  137. package/dist/core/question-engine.js +0 -356
  138. package/dist/core/session-manager.d.ts +0 -139
  139. package/dist/core/session-manager.js +0 -365
  140. package/dist/core/task-manager.d.ts +0 -211
  141. package/dist/core/task-manager.js +0 -981
  142. package/dist/core/verification-hooks.d.ts +0 -67
  143. package/dist/core/verification-hooks.js +0 -309
  144. package/dist/core/verification-manager.d.ts +0 -107
  145. package/dist/core/verification-manager.js +0 -415
  146. package/dist/index 2.js +0 -13
  147. package/dist/index.d 2.ts +0 -4
  148. package/dist/types/session.d.ts +0 -78
  149. package/dist/types/session.js +0 -8
  150. package/dist/types/verification.d.ts +0 -205
  151. package/dist/types/verification.js +0 -9
@@ -1,239 +0,0 @@
1
- import { BasePattern, } from './base-pattern.js';
2
- /**
3
- * v4.5 Pattern: Alternative Phrasing Generator
4
- *
5
- * Generates 2-3 alternative prompt structures to give users options
6
- * for different approaches to the same request.
7
- */
8
- export class AlternativePhrasingGenerator extends BasePattern {
9
- // -------------------------------------------------------------------------
10
- // Pattern Metadata (v4.5 unified types)
11
- // -------------------------------------------------------------------------
12
- id = 'alternative-phrasing-generator';
13
- name = 'Alternative Phrasing Generator';
14
- description = 'Generate alternative prompt structures for different approaches';
15
- applicableIntents = [
16
- 'code-generation',
17
- 'planning',
18
- 'debugging',
19
- 'testing',
20
- 'migration',
21
- 'security-review',
22
- 'documentation',
23
- ];
24
- scope = 'comprehensive';
25
- priority = 3; // VERY LOW - final touches
26
- phases = ['all'];
27
- // -------------------------------------------------------------------------
28
- // Configuration Schema (v4.5)
29
- // -------------------------------------------------------------------------
30
- static configSchema = {
31
- maxAlternatives: {
32
- type: 'number',
33
- default: 3,
34
- description: 'Maximum number of alternative approaches to generate',
35
- validation: { min: 1, max: 5 },
36
- },
37
- };
38
- // -------------------------------------------------------------------------
39
- // Pattern Application
40
- // -------------------------------------------------------------------------
41
- apply(prompt, context) {
42
- const alternatives = this.generateAlternatives(prompt, context.intent.primaryIntent);
43
- if (alternatives.length === 0) {
44
- return {
45
- enhancedPrompt: prompt,
46
- improvement: {
47
- dimension: 'structure',
48
- description: 'No alternative phrasings needed',
49
- impact: 'low',
50
- },
51
- applied: false,
52
- };
53
- }
54
- // Append alternatives section to the prompt
55
- const alternativesSection = this.formatAlternativesSection(alternatives);
56
- const enhancedPrompt = `${prompt}\n\n${alternativesSection}`;
57
- return {
58
- enhancedPrompt,
59
- improvement: {
60
- dimension: 'structure',
61
- description: `Generated ${alternatives.length} alternative approaches`,
62
- impact: 'medium',
63
- },
64
- applied: true,
65
- };
66
- }
67
- generateAlternatives(prompt, intent) {
68
- const alternatives = [];
69
- // Intent-specific alternative generation
70
- switch (intent) {
71
- case 'code-generation':
72
- alternatives.push(...this.generateCodeAlternatives(prompt));
73
- break;
74
- case 'planning':
75
- alternatives.push(...this.generatePlanningAlternatives(prompt));
76
- break;
77
- case 'debugging':
78
- alternatives.push(...this.generateDebuggingAlternatives(prompt));
79
- break;
80
- case 'testing':
81
- alternatives.push(...this.generateTestingAlternatives(prompt));
82
- break;
83
- case 'migration':
84
- alternatives.push(...this.generateMigrationAlternatives(prompt));
85
- break;
86
- case 'security-review':
87
- alternatives.push(...this.generateSecurityAlternatives(prompt));
88
- break;
89
- case 'documentation':
90
- alternatives.push(...this.generateDocumentationAlternatives(prompt));
91
- break;
92
- }
93
- return alternatives.slice(0, 3); // Max 3 alternatives
94
- }
95
- generateCodeAlternatives(_prompt) {
96
- return [
97
- {
98
- title: 'Functional Decomposition',
99
- description: 'Break down into discrete functions with clear interfaces',
100
- bestFor: 'Step-by-step implementation, clarity on sequence',
101
- },
102
- {
103
- title: 'Test-Driven Approach',
104
- description: 'Define expected behavior through tests first',
105
- bestFor: 'When requirements are clear and testable',
106
- },
107
- {
108
- title: 'Example-Driven',
109
- description: 'Provide concrete input/output examples',
110
- bestFor: 'When you have reference implementations',
111
- },
112
- ];
113
- }
114
- generatePlanningAlternatives(_prompt) {
115
- return [
116
- {
117
- title: 'Top-Down Design',
118
- description: 'Start with high-level architecture, then decompose',
119
- bestFor: 'Complex systems with clear boundaries',
120
- },
121
- {
122
- title: 'User Story Mapping',
123
- description: 'Organize around user journeys and value delivery',
124
- bestFor: 'User-facing features and workflows',
125
- },
126
- {
127
- title: 'Domain-Driven Approach',
128
- description: 'Model based on business domain concepts',
129
- bestFor: 'Business logic-heavy applications',
130
- },
131
- ];
132
- }
133
- generateDebuggingAlternatives(_prompt) {
134
- return [
135
- {
136
- title: 'Binary Search',
137
- description: 'Isolate the problem by eliminating half the code at a time',
138
- bestFor: 'When the bug location is unknown',
139
- },
140
- {
141
- title: 'Trace Analysis',
142
- description: 'Follow data flow through the system step by step',
143
- bestFor: 'Data transformation or state issues',
144
- },
145
- {
146
- title: 'Hypothesis Testing',
147
- description: 'Form specific hypotheses and test each one',
148
- bestFor: 'Complex, intermittent, or hard-to-reproduce bugs',
149
- },
150
- ];
151
- }
152
- generateTestingAlternatives(_prompt) {
153
- return [
154
- {
155
- title: 'Behavior-Driven',
156
- description: 'Write tests as specifications of expected behavior',
157
- bestFor: 'Feature validation and acceptance testing',
158
- },
159
- {
160
- title: 'Property-Based',
161
- description: 'Define properties that should hold for any input',
162
- bestFor: 'Edge cases and data validation',
163
- },
164
- {
165
- title: 'Snapshot Testing',
166
- description: 'Capture and compare output snapshots',
167
- bestFor: 'UI components and serializable outputs',
168
- },
169
- ];
170
- }
171
- generateMigrationAlternatives(_prompt) {
172
- return [
173
- {
174
- title: 'Big Bang Migration',
175
- description: 'Complete migration in one release',
176
- bestFor: 'Small systems or when downtime is acceptable',
177
- },
178
- {
179
- title: 'Strangler Fig Pattern',
180
- description: 'Gradually replace old system piece by piece',
181
- bestFor: 'Large systems requiring zero downtime',
182
- },
183
- {
184
- title: 'Parallel Running',
185
- description: 'Run both systems simultaneously and compare',
186
- bestFor: 'Critical systems requiring validation',
187
- },
188
- ];
189
- }
190
- generateSecurityAlternatives(_prompt) {
191
- return [
192
- {
193
- title: 'Threat Modeling',
194
- description: 'Identify attack surfaces and threat actors first',
195
- bestFor: 'Comprehensive security assessment',
196
- },
197
- {
198
- title: 'OWASP Checklist',
199
- description: 'Systematic check against common vulnerabilities',
200
- bestFor: 'Web application security review',
201
- },
202
- {
203
- title: 'Attack Simulation',
204
- description: 'Think like an attacker, test exploitability',
205
- bestFor: 'Penetration testing mindset',
206
- },
207
- ];
208
- }
209
- generateDocumentationAlternatives(_prompt) {
210
- return [
211
- {
212
- title: 'Tutorial Style',
213
- description: 'Step-by-step guide with examples',
214
- bestFor: 'Onboarding and learning',
215
- },
216
- {
217
- title: 'Reference Format',
218
- description: 'Comprehensive API/function reference',
219
- bestFor: 'Quick lookup and experienced users',
220
- },
221
- {
222
- title: 'Conceptual Overview',
223
- description: 'Explain the "why" and mental models',
224
- bestFor: 'Understanding architecture and design decisions',
225
- },
226
- ];
227
- }
228
- formatAlternativesSection(alternatives) {
229
- const lines = ['### Alternative Approaches', ''];
230
- alternatives.forEach((alt, index) => {
231
- lines.push(`**${index + 1}. ${alt.title}**`);
232
- lines.push(` ${alt.description}`);
233
- lines.push(` → Best for: ${alt.bestFor}`);
234
- lines.push('');
235
- });
236
- return lines.join('\n');
237
- }
238
- }
239
- //# sourceMappingURL=alternative-phrasing-generator.js.map
@@ -1,22 +0,0 @@
1
- import { BasePattern, PatternScope, PatternPriority, PatternPhase, PatternConfigSchema } from './base-pattern.js';
2
- import { PatternContext, PatternResult, PromptIntent } from '../types.js';
3
- /**
4
- * v4.5 Pattern: Ambiguity Detector
5
- *
6
- * Identifies and clarifies ambiguous terms, vague references, and unclear
7
- * specifications in prompts. Helps agents understand exactly what's needed.
8
- */
9
- export declare class AmbiguityDetector extends BasePattern {
10
- readonly id = "ambiguity-detector";
11
- readonly name = "Ambiguity Detector";
12
- readonly description = "Identifies and clarifies ambiguous terms and vague references";
13
- readonly applicableIntents: PromptIntent[];
14
- readonly scope: PatternScope;
15
- readonly priority: PatternPriority;
16
- readonly phases: PatternPhase[];
17
- static readonly configSchema: PatternConfigSchema;
18
- private ambiguousTerms;
19
- private vaguePatterns;
20
- apply(prompt: string, _context: PatternContext): PatternResult;
21
- }
22
- //# sourceMappingURL=ambiguity-detector.d.ts.map
@@ -1,196 +0,0 @@
1
- import { BasePattern, } from './base-pattern.js';
2
- /**
3
- * v4.5 Pattern: Ambiguity Detector
4
- *
5
- * Identifies and clarifies ambiguous terms, vague references, and unclear
6
- * specifications in prompts. Helps agents understand exactly what's needed.
7
- */
8
- export class AmbiguityDetector extends BasePattern {
9
- // -------------------------------------------------------------------------
10
- // Pattern Metadata (v4.5 unified types)
11
- // -------------------------------------------------------------------------
12
- id = 'ambiguity-detector';
13
- name = 'Ambiguity Detector';
14
- description = 'Identifies and clarifies ambiguous terms and vague references';
15
- applicableIntents = [
16
- 'code-generation',
17
- 'planning',
18
- 'refinement',
19
- 'debugging',
20
- 'documentation',
21
- 'prd-generation',
22
- 'testing',
23
- 'migration',
24
- ];
25
- scope = 'both';
26
- priority = 9; // VERY HIGH - structural integrity
27
- phases = ['all'];
28
- // -------------------------------------------------------------------------
29
- // Configuration Schema (v4.5)
30
- // -------------------------------------------------------------------------
31
- static configSchema = {
32
- checkVaguePatterns: {
33
- type: 'boolean',
34
- default: true,
35
- description: 'Check for vague phrases like "should work", "properly", etc.',
36
- },
37
- checkUndefinedPronouns: {
38
- type: 'boolean',
39
- default: true,
40
- description: 'Check for unclear pronoun references',
41
- },
42
- maxClarifications: {
43
- type: 'number',
44
- default: 10,
45
- description: 'Maximum number of clarifications to add',
46
- validation: { min: 1, max: 20 },
47
- },
48
- };
49
- // -------------------------------------------------------------------------
50
- // Pattern Data
51
- // -------------------------------------------------------------------------
52
- // Common ambiguous terms that need clarification
53
- ambiguousTerms = {
54
- // Generic terms needing specificity
55
- app: ['web app', 'mobile app', 'desktop app', 'CLI tool'],
56
- system: ['backend system', 'frontend system', 'full-stack system', 'microservice'],
57
- feature: ['user-facing feature', 'backend feature', 'API endpoint', 'UI component'],
58
- component: ['React component', 'Vue component', 'service component', 'module'],
59
- service: ['REST API', 'GraphQL API', 'background worker', 'microservice'],
60
- database: ['PostgreSQL', 'MongoDB', 'MySQL', 'SQLite', 'Redis'],
61
- authentication: ['OAuth', 'JWT', 'session-based', 'API keys', 'social login'],
62
- cache: ['in-memory cache', 'Redis cache', 'CDN cache', 'browser cache'],
63
- storage: ['local storage', 'cloud storage', 'file system', 'object storage'],
64
- user: ['end user', 'admin user', 'API consumer', 'authenticated user'],
65
- // Action verbs needing clarification
66
- create: ['generate', 'implement', 'design', 'scaffold'],
67
- update: ['modify', 'patch', 'replace', 'extend'],
68
- fix: ['debug', 'patch', 'refactor', 'rewrite'],
69
- improve: ['optimize', 'refactor', 'enhance', 'extend'],
70
- handle: ['process', 'validate', 'transform', 'route'],
71
- // Scope terms
72
- some: ['specific subset', 'all matching', 'first N', 'random sample'],
73
- many: ['more than 10', 'more than 100', 'more than 1000', 'unlimited'],
74
- few: ['2-3', '5-10', 'less than 10'],
75
- large: ['>1MB', '>100MB', '>1GB', 'unbounded'],
76
- small: ['<1KB', '<100KB', '<1MB'],
77
- fast: ['<100ms', '<1s', '<5s', 'real-time'],
78
- slow: ['>1s', '>5s', '>30s'],
79
- // Quality terms
80
- good: ['>80% coverage', '>90% accuracy', 'production-ready', 'MVP-quality'],
81
- better: ['improved by X%', 'faster than current', 'more readable'],
82
- best: ['optimal', 'industry standard', 'team consensus'],
83
- simple: ['single function', 'minimal dependencies', 'no external calls'],
84
- complex: ['multi-step', 'with dependencies', 'requiring state'],
85
- };
86
- // Vague phrases that need clarification
87
- vaguePatterns = [
88
- {
89
- pattern: /\bshould work\b/gi,
90
- suggestion: 'Define specific success criteria and test cases',
91
- },
92
- {
93
- pattern: /\bproperly\b/gi,
94
- suggestion: 'Specify exact behavior or standards to follow',
95
- },
96
- {
97
- pattern: /\bcorrectly\b/gi,
98
- suggestion: 'Define what "correct" means with specific criteria',
99
- },
100
- {
101
- pattern: /\bappropriate(ly)?\b/gi,
102
- suggestion: 'Specify the exact behavior or standards expected',
103
- },
104
- {
105
- pattern: /\bas needed\b/gi,
106
- suggestion: 'Define when and what is needed specifically',
107
- },
108
- {
109
- pattern: /\bif necessary\b/gi,
110
- suggestion: 'Define the conditions that trigger this action',
111
- },
112
- {
113
- pattern: /\betc\.?\b/gi,
114
- suggestion: 'List all items explicitly or define a complete category',
115
- },
116
- {
117
- pattern: /\band so on\b/gi,
118
- suggestion: 'Enumerate all items or define the pattern explicitly',
119
- },
120
- {
121
- pattern: /\bwhatever\b/gi,
122
- suggestion: 'Specify the exact options or constraints',
123
- },
124
- {
125
- pattern: /\bsomething like\b/gi,
126
- suggestion: 'Provide the exact specification or reference',
127
- },
128
- {
129
- pattern: /\bmaybe\b/gi,
130
- suggestion: 'Decide if this is a requirement or not',
131
- },
132
- {
133
- pattern: /\bprobably\b/gi,
134
- suggestion: 'Confirm if this is a requirement or not',
135
- },
136
- ];
137
- apply(prompt, _context) {
138
- let enhanced = prompt;
139
- const ambiguitiesFound = [];
140
- const clarifications = [];
141
- // Check for ambiguous terms
142
- for (const [term, options] of Object.entries(this.ambiguousTerms)) {
143
- const regex = new RegExp(`\\b${term}\\b`, 'gi');
144
- if (regex.test(prompt)) {
145
- // Check if the term is already qualified
146
- const qualifiedPattern = new RegExp(`\\b(${options.join('|')})\\s+${term}\\b|\\b${term}\\s+(${options.join('|')})\\b`, 'gi');
147
- if (!qualifiedPattern.test(prompt)) {
148
- ambiguitiesFound.push(`"${term}" is ambiguous`);
149
- clarifications.push(`[CLARIFY: "${term}" - specify: ${options.slice(0, 3).join(', ')}?]`);
150
- }
151
- }
152
- }
153
- // Check for vague phrases
154
- for (const { pattern, suggestion } of this.vaguePatterns) {
155
- if (pattern.test(prompt)) {
156
- ambiguitiesFound.push(`Found vague phrase matching: ${pattern.source}`);
157
- clarifications.push(`[CLARIFY: ${suggestion}]`);
158
- }
159
- }
160
- // Check for undefined pronouns
161
- const pronounPatterns = [
162
- { pattern: /\bit\b(?!eration|em|erable)/gi, issue: '"it" - unclear reference' },
163
- { pattern: /\bthis\b(?!\s+\w+)/gi, issue: '"this" - unclear reference' },
164
- { pattern: /\bthat\b(?!\s+\w+)/gi, issue: '"that" - unclear reference' },
165
- { pattern: /\bthey\b/gi, issue: '"they" - unclear reference' },
166
- { pattern: /\bthose\b(?!\s+\w+)/gi, issue: '"those" - unclear reference' },
167
- ];
168
- for (const { pattern, issue } of pronounPatterns) {
169
- const matches = prompt.match(pattern);
170
- if (matches && matches.length > 0) {
171
- // Only flag if it appears at the start of a sentence or after punctuation
172
- const contextPattern = new RegExp(`[.!?]\\s*${pattern.source}|^${pattern.source}`, 'gi');
173
- if (contextPattern.test(prompt)) {
174
- ambiguitiesFound.push(issue);
175
- }
176
- }
177
- }
178
- // If ambiguities found, append clarification section
179
- if (clarifications.length > 0) {
180
- enhanced = prompt + '\n\n## Clarifications Needed\n' + clarifications.join('\n');
181
- }
182
- const applied = ambiguitiesFound.length > 0;
183
- return {
184
- enhancedPrompt: enhanced,
185
- improvement: {
186
- dimension: 'clarity',
187
- description: applied
188
- ? `Identified ${ambiguitiesFound.length} ambiguous terms/phrases requiring clarification`
189
- : 'No significant ambiguities detected',
190
- impact: ambiguitiesFound.length > 3 ? 'high' : ambiguitiesFound.length > 1 ? 'medium' : 'low',
191
- },
192
- applied,
193
- };
194
- }
195
- }
196
- //# sourceMappingURL=ambiguity-detector.js.map
@@ -1,30 +0,0 @@
1
- import { BasePattern, PatternScope, PatternPriority, PatternPhase, PatternConfigSchema } from './base-pattern.js';
2
- import { PromptIntent, PatternContext, PatternResult } from '../types.js';
3
- /**
4
- * v4.5 Pattern: Assumption Explicitizer
5
- *
6
- * Makes implicit assumptions explicit to prevent misunderstandings
7
- * and ensure comprehensive requirement coverage.
8
- */
9
- export declare class AssumptionExplicitizer extends BasePattern {
10
- readonly id = "assumption-explicitizer";
11
- readonly name = "Assumption Explicitizer";
12
- readonly description = "Make implicit assumptions explicit to prevent misunderstandings";
13
- readonly applicableIntents: PromptIntent[];
14
- readonly scope: PatternScope;
15
- readonly priority: PatternPriority;
16
- readonly phases: PatternPhase[];
17
- static readonly configSchema: PatternConfigSchema;
18
- apply(prompt: string, context: PatternContext): PatternResult;
19
- private identifyAssumptions;
20
- private identifyMissingContext;
21
- private getCodeAssumptions;
22
- private getPlanningAssumptions;
23
- private getMigrationAssumptions;
24
- private getTestingAssumptions;
25
- private getDebuggingAssumptions;
26
- private getDomainAssumptions;
27
- private deduplicateAssumptions;
28
- private formatAssumptionsSection;
29
- }
30
- //# sourceMappingURL=assumption-explicitizer.d.ts.map