clavix 4.4.0 → 4.6.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 (74) hide show
  1. package/dist/core/adapters/instructions-generator.d.ts +2 -1
  2. package/dist/core/adapters/instructions-generator.js +21 -8
  3. package/dist/core/intelligence/confidence-calculator.d.ts +93 -0
  4. package/dist/core/intelligence/confidence-calculator.js +124 -0
  5. package/dist/core/intelligence/index.d.ts +1 -0
  6. package/dist/core/intelligence/index.js +2 -0
  7. package/dist/core/intelligence/intent-detector.js +10 -8
  8. package/dist/core/intelligence/pattern-library.d.ts +34 -12
  9. package/dist/core/intelligence/pattern-library.js +120 -85
  10. package/dist/core/intelligence/patterns/actionability-enhancer.d.ts +10 -10
  11. package/dist/core/intelligence/patterns/actionability-enhancer.js +31 -6
  12. package/dist/core/intelligence/patterns/alternative-phrasing-generator.d.ts +10 -8
  13. package/dist/core/intelligence/patterns/alternative-phrasing-generator.js +21 -3
  14. package/dist/core/intelligence/patterns/ambiguity-detector.d.ts +10 -8
  15. package/dist/core/intelligence/patterns/ambiguity-detector.js +31 -3
  16. package/dist/core/intelligence/patterns/assumption-explicitizer.d.ts +10 -8
  17. package/dist/core/intelligence/patterns/assumption-explicitizer.js +26 -3
  18. package/dist/core/intelligence/patterns/base-pattern.d.ts +166 -8
  19. package/dist/core/intelligence/patterns/base-pattern.js +64 -4
  20. package/dist/core/intelligence/patterns/completeness-validator.d.ts +10 -10
  21. package/dist/core/intelligence/patterns/completeness-validator.js +26 -5
  22. package/dist/core/intelligence/patterns/conciseness-filter.d.ts +15 -7
  23. package/dist/core/intelligence/patterns/conciseness-filter.js +36 -4
  24. package/dist/core/intelligence/patterns/context-precision.d.ts +10 -8
  25. package/dist/core/intelligence/patterns/context-precision.js +28 -5
  26. package/dist/core/intelligence/patterns/conversation-summarizer.d.ts +11 -9
  27. package/dist/core/intelligence/patterns/conversation-summarizer.js +40 -16
  28. package/dist/core/intelligence/patterns/dependency-identifier.d.ts +11 -9
  29. package/dist/core/intelligence/patterns/dependency-identifier.js +21 -4
  30. package/dist/core/intelligence/patterns/domain-context-enricher.d.ts +10 -8
  31. package/dist/core/intelligence/patterns/domain-context-enricher.js +27 -3
  32. package/dist/core/intelligence/patterns/edge-case-identifier.d.ts +10 -8
  33. package/dist/core/intelligence/patterns/edge-case-identifier.js +21 -3
  34. package/dist/core/intelligence/patterns/error-tolerance-enhancer.d.ts +10 -8
  35. package/dist/core/intelligence/patterns/error-tolerance-enhancer.js +22 -4
  36. package/dist/core/intelligence/patterns/implicit-requirement-extractor.d.ts +11 -9
  37. package/dist/core/intelligence/patterns/implicit-requirement-extractor.js +27 -4
  38. package/dist/core/intelligence/patterns/objective-clarifier.d.ts +15 -7
  39. package/dist/core/intelligence/patterns/objective-clarifier.js +46 -17
  40. package/dist/core/intelligence/patterns/output-format-enforcer.d.ts +10 -8
  41. package/dist/core/intelligence/patterns/output-format-enforcer.js +20 -3
  42. package/dist/core/intelligence/patterns/prd-structure-enforcer.d.ts +10 -8
  43. package/dist/core/intelligence/patterns/prd-structure-enforcer.js +25 -3
  44. package/dist/core/intelligence/patterns/prerequisite-identifier.d.ts +10 -8
  45. package/dist/core/intelligence/patterns/prerequisite-identifier.js +28 -4
  46. package/dist/core/intelligence/patterns/requirement-prioritizer.d.ts +11 -9
  47. package/dist/core/intelligence/patterns/requirement-prioritizer.js +21 -4
  48. package/dist/core/intelligence/patterns/scope-definer.d.ts +10 -8
  49. package/dist/core/intelligence/patterns/scope-definer.js +27 -3
  50. package/dist/core/intelligence/patterns/step-decomposer.d.ts +10 -8
  51. package/dist/core/intelligence/patterns/step-decomposer.js +21 -3
  52. package/dist/core/intelligence/patterns/structure-organizer.d.ts +10 -10
  53. package/dist/core/intelligence/patterns/structure-organizer.js +25 -5
  54. package/dist/core/intelligence/patterns/success-criteria-enforcer.d.ts +10 -8
  55. package/dist/core/intelligence/patterns/success-criteria-enforcer.js +20 -3
  56. package/dist/core/intelligence/patterns/success-metrics-enforcer.d.ts +11 -9
  57. package/dist/core/intelligence/patterns/success-metrics-enforcer.js +27 -4
  58. package/dist/core/intelligence/patterns/technical-context-enricher.d.ts +16 -7
  59. package/dist/core/intelligence/patterns/technical-context-enricher.js +71 -38
  60. package/dist/core/intelligence/patterns/topic-coherence-analyzer.d.ts +11 -9
  61. package/dist/core/intelligence/patterns/topic-coherence-analyzer.js +22 -4
  62. package/dist/core/intelligence/patterns/user-persona-enricher.d.ts +11 -9
  63. package/dist/core/intelligence/patterns/user-persona-enricher.js +21 -4
  64. package/dist/core/intelligence/patterns/validation-checklist-creator.d.ts +11 -8
  65. package/dist/core/intelligence/patterns/validation-checklist-creator.js +31 -3
  66. package/dist/templates/slash-commands/_canonical/archive.md +1 -1
  67. package/dist/templates/slash-commands/_canonical/deep.md +5 -2
  68. package/dist/templates/slash-commands/_canonical/fast.md +10 -2
  69. package/dist/templates/slash-commands/_canonical/prd.md +4 -1
  70. package/dist/templates/slash-commands/_components/agent-protocols/assertion-checkpoints.md +122 -0
  71. package/dist/templates/slash-commands/_components/agent-protocols/decision-rules.md +29 -0
  72. package/dist/templates/slash-commands/_components/references/intent-types.md +3 -1
  73. package/dist/templates/slash-commands/_components/sections/pattern-visibility.md +14 -12
  74. package/package.json +1 -1
@@ -33,25 +33,32 @@ import { ImplicitRequirementExtractor } from './patterns/implicit-requirement-ex
33
33
  export class PatternLibrary {
34
34
  patterns = new Map();
35
35
  config = null;
36
+ priorityOverrides = new Map();
36
37
  constructor() {
37
38
  this.registerDefaultPatterns();
38
39
  }
39
40
  /**
40
- * v4.4: Apply configuration settings to pattern library
41
- * Allows enabling/disabling patterns and adjusting priorities via config
41
+ * v4.5: Apply configuration settings to pattern library
42
+ * Allows enabling/disabling patterns and adjusting priorities via config.
43
+ * Priority overrides are stored separately (pattern.priority is readonly).
42
44
  */
43
45
  applyConfig(config) {
44
46
  this.config = config;
45
- // Apply priority overrides
47
+ // Store priority overrides (patterns have readonly priority)
46
48
  if (config.patterns?.priorityOverrides) {
47
49
  for (const [patternId, newPriority] of Object.entries(config.patterns.priorityOverrides)) {
48
- const pattern = this.patterns.get(patternId);
49
- if (pattern && newPriority >= 1 && newPriority <= 10) {
50
- pattern.priority = newPriority;
50
+ if (this.patterns.has(patternId) && newPriority >= 1 && newPriority <= 10) {
51
+ this.priorityOverrides.set(patternId, newPriority);
51
52
  }
52
53
  }
53
54
  }
54
55
  }
56
+ /**
57
+ * v4.5: Get effective priority for a pattern (considers overrides)
58
+ */
59
+ getEffectivePriority(pattern) {
60
+ return this.priorityOverrides.get(pattern.id) ?? pattern.priority;
61
+ }
55
62
  /**
56
63
  * v4.4: Check if a pattern is disabled via config
57
64
  */
@@ -100,9 +107,12 @@ export class PatternLibrary {
100
107
  this.register(new ImplicitRequirementExtractor()); // P7 - Surface implicit requirements
101
108
  }
102
109
  /**
103
- * Register a new pattern
110
+ * Register a new pattern.
111
+ * v4.5: Injects library reference for config access.
104
112
  */
105
113
  register(pattern) {
114
+ // Inject library reference for config access
115
+ pattern.setPatternLibrary(this);
106
116
  this.patterns.set(pattern.id, pattern);
107
117
  }
108
118
  /**
@@ -150,11 +160,81 @@ export class PatternLibrary {
150
160
  }
151
161
  applicablePatterns.push(pattern);
152
162
  }
153
- // Sort by priority (highest first)
154
- return applicablePatterns.sort((a, b) => b.priority - a.priority);
163
+ // v4.5: Sort by priority and respect dependencies
164
+ return this.sortPatternsWithDependencies(applicablePatterns);
165
+ }
166
+ /**
167
+ * v4.5: Sort patterns by priority while respecting dependency constraints.
168
+ * Handles runAfter (must run after specified patterns) and excludesWith (mutually exclusive).
169
+ */
170
+ sortPatternsWithDependencies(patterns) {
171
+ // First, handle exclusions - remove patterns that conflict with higher priority ones
172
+ const filteredPatterns = this.filterExcludedPatterns(patterns);
173
+ // Sort by priority first
174
+ const sortedByPriority = [...filteredPatterns].sort((a, b) => this.getEffectivePriority(b) - this.getEffectivePriority(a));
175
+ // Then adjust for runAfter dependencies
176
+ return this.adjustForDependencies(sortedByPriority);
177
+ }
178
+ /**
179
+ * v4.5: Filter out patterns that are mutually exclusive with higher priority patterns.
180
+ */
181
+ filterExcludedPatterns(patterns) {
182
+ // Sort by priority (highest first) to determine which exclusion wins
183
+ const sortedByPriority = [...patterns].sort((a, b) => this.getEffectivePriority(b) - this.getEffectivePriority(a));
184
+ const excludedIds = new Set();
185
+ for (const pattern of sortedByPriority) {
186
+ // Skip if this pattern was already excluded
187
+ if (excludedIds.has(pattern.id)) {
188
+ continue;
189
+ }
190
+ // Check if this pattern excludes others
191
+ const excludes = pattern.dependencies?.excludesWith || [];
192
+ for (const excludedId of excludes) {
193
+ excludedIds.add(excludedId);
194
+ }
195
+ }
196
+ // Return patterns that weren't excluded
197
+ return sortedByPriority.filter((p) => !excludedIds.has(p.id));
198
+ }
199
+ /**
200
+ * v4.5: Adjust pattern order to respect runAfter dependencies.
201
+ * If pattern A declares runAfter: ['B'], ensure B runs before A.
202
+ */
203
+ adjustForDependencies(patterns) {
204
+ const patternMap = new Map(patterns.map((p) => [p.id, p]));
205
+ const result = [];
206
+ const processed = new Set();
207
+ const processing = new Set();
208
+ // Depth-first processing to handle dependencies
209
+ const processPattern = (pattern) => {
210
+ if (processed.has(pattern.id)) {
211
+ return; // Already processed
212
+ }
213
+ if (processing.has(pattern.id)) {
214
+ // Circular dependency detected - skip to avoid infinite loop
215
+ return;
216
+ }
217
+ processing.add(pattern.id);
218
+ // Process dependencies first (patterns that must run before this one)
219
+ const runAfter = pattern.dependencies?.runAfter || [];
220
+ for (const depId of runAfter) {
221
+ const depPattern = patternMap.get(depId);
222
+ if (depPattern && !processed.has(depId)) {
223
+ processPattern(depPattern);
224
+ }
225
+ }
226
+ processing.delete(pattern.id);
227
+ processed.add(pattern.id);
228
+ result.push(pattern);
229
+ };
230
+ // Process all patterns in priority order
231
+ for (const pattern of patterns) {
232
+ processPattern(pattern);
233
+ }
234
+ return result;
155
235
  }
156
236
  /**
157
- * v4.3.2: Select patterns for specific mode with phase-awareness
237
+ * v4.5: Select patterns for specific mode with phase-awareness
158
238
  * Maps PRD and conversational modes to appropriate base modes and patterns
159
239
  */
160
240
  selectPatternsForMode(mode, intent, phase) {
@@ -174,22 +254,39 @@ export class PatternLibrary {
174
254
  if (!pattern.applicableIntents.includes(intent.primaryIntent)) {
175
255
  continue;
176
256
  }
177
- // Phase-specific filtering for PRD mode
178
- if (mode === 'prd' && phase) {
179
- if (!this.isPatternApplicableForPRDPhase(pattern, phase)) {
180
- continue;
181
- }
182
- }
183
- // Phase-specific filtering for conversational mode
184
- if (mode === 'conversational' && phase) {
185
- if (!this.isPatternApplicableForConversationalPhase(pattern, phase)) {
186
- continue;
187
- }
257
+ // v4.5: Phase-specific filtering using pattern's phases property
258
+ if (phase && !this.isPatternApplicableForPhase(pattern, phase)) {
259
+ continue;
188
260
  }
189
261
  applicablePatterns.push(pattern);
190
262
  }
191
- // Sort by priority (highest first)
192
- return applicablePatterns.sort((a, b) => b.priority - a.priority);
263
+ // v4.5: Sort by priority and respect dependencies
264
+ return this.sortPatternsWithDependencies(applicablePatterns);
265
+ }
266
+ /**
267
+ * v4.5: Check if pattern is applicable for a given phase.
268
+ * Uses pattern's declared phases property instead of hardcoded mappings.
269
+ */
270
+ isPatternApplicableForPhase(pattern, phase) {
271
+ // Map OptimizationPhase to PatternPhase
272
+ const patternPhase = this.mapOptimizationPhaseToPatternPhase(phase);
273
+ if (!patternPhase) {
274
+ return true; // Unknown phase, allow pattern
275
+ }
276
+ // Check if pattern applies to this phase or to 'all' phases
277
+ return pattern.phases.includes('all') || pattern.phases.includes(patternPhase);
278
+ }
279
+ /**
280
+ * v4.5: Map OptimizationPhase string to PatternPhase type
281
+ */
282
+ mapOptimizationPhaseToPatternPhase(phase) {
283
+ const mapping = {
284
+ 'question-validation': 'question-validation',
285
+ 'output-generation': 'output-generation',
286
+ 'conversation-tracking': 'conversation-tracking',
287
+ summarization: 'summarization',
288
+ };
289
+ return mapping[phase] || null;
193
290
  }
194
291
  /**
195
292
  * Map extended modes to base modes for pattern compatibility
@@ -208,68 +305,6 @@ export class PatternLibrary {
208
305
  return mode;
209
306
  }
210
307
  }
211
- /**
212
- * Check if pattern is applicable for PRD phase
213
- */
214
- isPatternApplicableForPRDPhase(pattern, phase) {
215
- // Patterns for question validation (lightweight, clarity-focused)
216
- const questionValidationPatterns = [
217
- 'ambiguity-detector',
218
- 'completeness-validator',
219
- 'objective-clarifier',
220
- ];
221
- // Patterns for output generation (comprehensive)
222
- const outputGenerationPatterns = [
223
- 'prd-structure-enforcer',
224
- 'structure-organizer',
225
- 'success-criteria-enforcer',
226
- 'scope-definer',
227
- 'edge-case-identifier',
228
- 'assumption-explicitizer',
229
- 'technical-context-enricher',
230
- 'domain-context-enricher',
231
- // v4.3.2 PRD patterns will be added here
232
- 'requirement-prioritizer',
233
- 'user-persona-enricher',
234
- 'success-metrics-enforcer',
235
- 'dependency-identifier',
236
- ];
237
- if (phase === 'question-validation') {
238
- return questionValidationPatterns.includes(pattern.id);
239
- }
240
- if (phase === 'output-generation') {
241
- return outputGenerationPatterns.includes(pattern.id);
242
- }
243
- return true; // Default: allow pattern
244
- }
245
- /**
246
- * Check if pattern is applicable for conversational phase
247
- */
248
- isPatternApplicableForConversationalPhase(pattern, phase) {
249
- // Patterns for conversation tracking (minimal, non-intrusive)
250
- const conversationTrackingPatterns = ['ambiguity-detector', 'completeness-validator'];
251
- // Patterns for summarization (comprehensive extraction)
252
- const summarizationPatterns = [
253
- 'structure-organizer',
254
- 'completeness-validator',
255
- 'success-criteria-enforcer',
256
- 'edge-case-identifier',
257
- 'actionability-enhancer',
258
- 'technical-context-enricher',
259
- 'domain-context-enricher',
260
- // v4.3.2 Conversational patterns will be added here
261
- 'conversation-summarizer',
262
- 'topic-coherence-analyzer',
263
- 'implicit-requirement-extractor',
264
- ];
265
- if (phase === 'conversation-tracking') {
266
- return conversationTrackingPatterns.includes(pattern.id);
267
- }
268
- if (phase === 'summarization') {
269
- return summarizationPatterns.includes(pattern.id);
270
- }
271
- return true; // Default: allow pattern
272
- }
273
308
  /**
274
309
  * Get all registered patterns
275
310
  */
@@ -1,20 +1,20 @@
1
- import { BasePattern } from './base-pattern.js';
1
+ import { BasePattern, PatternMode, PatternPriority, PatternPhase, PatternConfigSchema } from './base-pattern.js';
2
2
  import { PatternContext, PatternResult, PromptIntent } from '../types.js';
3
3
  /**
4
- * Actionability Enhancer Pattern
4
+ * v4.5 Pattern: Actionability Enhancer
5
5
  *
6
6
  * Converts vague goals into specific, actionable tasks.
7
7
  * Replaces abstract language with concrete requirements.
8
- *
9
- * Priority: HIGH (7)
10
8
  */
11
9
  export declare class ActionabilityEnhancer extends BasePattern {
12
- id: string;
13
- name: string;
14
- description: string;
15
- applicableIntents: PromptIntent[];
16
- mode: 'fast' | 'deep' | 'both';
17
- priority: number;
10
+ readonly id = "actionability-enhancer";
11
+ readonly name = "Actionability Enhancer";
12
+ readonly description = "Converts vague goals into specific, actionable tasks";
13
+ readonly applicableIntents: PromptIntent[];
14
+ readonly mode: PatternMode;
15
+ readonly priority: PatternPriority;
16
+ readonly phases: PatternPhase[];
17
+ static readonly configSchema: PatternConfigSchema;
18
18
  private readonly VAGUE_WORDS;
19
19
  apply(prompt: string, _context: PatternContext): PatternResult;
20
20
  private detectVagueWords;
@@ -1,19 +1,44 @@
1
- import { BasePattern } from './base-pattern.js';
1
+ import { BasePattern, } from './base-pattern.js';
2
2
  /**
3
- * Actionability Enhancer Pattern
3
+ * v4.5 Pattern: Actionability Enhancer
4
4
  *
5
5
  * Converts vague goals into specific, actionable tasks.
6
6
  * Replaces abstract language with concrete requirements.
7
- *
8
- * Priority: HIGH (7)
9
7
  */
10
8
  export class ActionabilityEnhancer extends BasePattern {
9
+ // -------------------------------------------------------------------------
10
+ // Pattern Metadata (v4.5 unified types)
11
+ // -------------------------------------------------------------------------
11
12
  id = 'actionability-enhancer';
12
13
  name = 'Actionability Enhancer';
13
14
  description = 'Converts vague goals into specific, actionable tasks';
14
- applicableIntents = ['code-generation', 'planning', 'refinement', 'debugging'];
15
+ applicableIntents = [
16
+ 'code-generation',
17
+ 'planning',
18
+ 'refinement',
19
+ 'debugging',
20
+ ];
15
21
  mode = 'both';
16
- priority = 7; // High priority
22
+ priority = 4; // LOW - polish phase
23
+ phases = ['all'];
24
+ // -------------------------------------------------------------------------
25
+ // Configuration Schema (v4.5)
26
+ // -------------------------------------------------------------------------
27
+ static configSchema = {
28
+ replaceVagueWords: {
29
+ type: 'boolean',
30
+ default: true,
31
+ description: 'Replace vague words with specific alternatives',
32
+ },
33
+ addMeasurableCriteria: {
34
+ type: 'boolean',
35
+ default: true,
36
+ description: 'Add suggestions for measurable criteria',
37
+ },
38
+ };
39
+ // -------------------------------------------------------------------------
40
+ // Pattern Data
41
+ // -------------------------------------------------------------------------
17
42
  VAGUE_WORDS = {
18
43
  better: ['faster', 'more efficient', 'more reliable', 'more maintainable'],
19
44
  improve: [
@@ -1,18 +1,20 @@
1
- import { BasePattern } from './base-pattern.js';
1
+ import { BasePattern, PatternMode, PatternPriority, PatternPhase, PatternConfigSchema } from './base-pattern.js';
2
2
  import { PromptIntent, PatternContext, PatternResult } from '../types.js';
3
3
  /**
4
- * v4.0 Deep Mode Pattern: Alternative Phrasing Generator
4
+ * v4.5 Pattern: Alternative Phrasing Generator
5
5
  *
6
6
  * Generates 2-3 alternative prompt structures to give users options
7
7
  * for different approaches to the same request.
8
8
  */
9
9
  export declare class AlternativePhrasingGenerator extends BasePattern {
10
- id: string;
11
- name: string;
12
- description: string;
13
- applicableIntents: PromptIntent[];
14
- mode: "deep";
15
- priority: number;
10
+ readonly id = "alternative-phrasing-generator";
11
+ readonly name = "Alternative Phrasing Generator";
12
+ readonly description = "Generate alternative prompt structures for different approaches";
13
+ readonly applicableIntents: PromptIntent[];
14
+ readonly mode: PatternMode;
15
+ readonly priority: PatternPriority;
16
+ readonly phases: PatternPhase[];
17
+ static readonly configSchema: PatternConfigSchema;
16
18
  apply(prompt: string, context: PatternContext): PatternResult;
17
19
  private generateAlternatives;
18
20
  private generateCodeAlternatives;
@@ -1,11 +1,14 @@
1
- import { BasePattern } from './base-pattern.js';
1
+ import { BasePattern, } from './base-pattern.js';
2
2
  /**
3
- * v4.0 Deep Mode Pattern: Alternative Phrasing Generator
3
+ * v4.5 Pattern: Alternative Phrasing Generator
4
4
  *
5
5
  * Generates 2-3 alternative prompt structures to give users options
6
6
  * for different approaches to the same request.
7
7
  */
8
8
  export class AlternativePhrasingGenerator extends BasePattern {
9
+ // -------------------------------------------------------------------------
10
+ // Pattern Metadata (v4.5 unified types)
11
+ // -------------------------------------------------------------------------
9
12
  id = 'alternative-phrasing-generator';
10
13
  name = 'Alternative Phrasing Generator';
11
14
  description = 'Generate alternative prompt structures for different approaches';
@@ -19,7 +22,22 @@ export class AlternativePhrasingGenerator extends BasePattern {
19
22
  'documentation',
20
23
  ];
21
24
  mode = 'deep';
22
- priority = 5;
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
+ // -------------------------------------------------------------------------
23
41
  apply(prompt, context) {
24
42
  const alternatives = this.generateAlternatives(prompt, context.intent.primaryIntent);
25
43
  if (alternatives.length === 0) {
@@ -1,18 +1,20 @@
1
- import { BasePattern } from './base-pattern.js';
1
+ import { BasePattern, PatternMode, PatternPriority, PatternPhase, PatternConfigSchema } from './base-pattern.js';
2
2
  import { PatternContext, PatternResult, PromptIntent } from '../types.js';
3
3
  /**
4
- * AmbiguityDetector Pattern (v4.1)
4
+ * v4.5 Pattern: Ambiguity Detector
5
5
  *
6
6
  * Identifies and clarifies ambiguous terms, vague references, and unclear
7
7
  * specifications in prompts. Helps agents understand exactly what's needed.
8
8
  */
9
9
  export declare class AmbiguityDetector extends BasePattern {
10
- id: string;
11
- name: string;
12
- description: string;
13
- applicableIntents: PromptIntent[];
14
- mode: 'fast' | 'deep' | 'both';
15
- priority: number;
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 mode: PatternMode;
15
+ readonly priority: PatternPriority;
16
+ readonly phases: PatternPhase[];
17
+ static readonly configSchema: PatternConfigSchema;
16
18
  private ambiguousTerms;
17
19
  private vaguePatterns;
18
20
  apply(prompt: string, _context: PatternContext): PatternResult;
@@ -1,11 +1,14 @@
1
- import { BasePattern } from './base-pattern.js';
1
+ import { BasePattern, } from './base-pattern.js';
2
2
  /**
3
- * AmbiguityDetector Pattern (v4.1)
3
+ * v4.5 Pattern: Ambiguity Detector
4
4
  *
5
5
  * Identifies and clarifies ambiguous terms, vague references, and unclear
6
6
  * specifications in prompts. Helps agents understand exactly what's needed.
7
7
  */
8
8
  export class AmbiguityDetector extends BasePattern {
9
+ // -------------------------------------------------------------------------
10
+ // Pattern Metadata (v4.5 unified types)
11
+ // -------------------------------------------------------------------------
9
12
  id = 'ambiguity-detector';
10
13
  name = 'Ambiguity Detector';
11
14
  description = 'Identifies and clarifies ambiguous terms and vague references';
@@ -20,7 +23,32 @@ export class AmbiguityDetector extends BasePattern {
20
23
  'migration',
21
24
  ];
22
25
  mode = 'both';
23
- priority = 9; // High priority - detect ambiguity early
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
+ // -------------------------------------------------------------------------
24
52
  // Common ambiguous terms that need clarification
25
53
  ambiguousTerms = {
26
54
  // Generic terms needing specificity
@@ -1,18 +1,20 @@
1
- import { BasePattern } from './base-pattern.js';
1
+ import { BasePattern, PatternMode, PatternPriority, PatternPhase, PatternConfigSchema } from './base-pattern.js';
2
2
  import { PromptIntent, PatternContext, PatternResult } from '../types.js';
3
3
  /**
4
- * v4.0 Deep Mode Pattern: Assumption Explicitizer
4
+ * v4.5 Pattern: Assumption Explicitizer
5
5
  *
6
6
  * Makes implicit assumptions explicit to prevent misunderstandings
7
7
  * and ensure comprehensive requirement coverage.
8
8
  */
9
9
  export declare class AssumptionExplicitizer extends BasePattern {
10
- id: string;
11
- name: string;
12
- description: string;
13
- applicableIntents: PromptIntent[];
14
- mode: "deep";
15
- priority: number;
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 mode: PatternMode;
15
+ readonly priority: PatternPriority;
16
+ readonly phases: PatternPhase[];
17
+ static readonly configSchema: PatternConfigSchema;
16
18
  apply(prompt: string, context: PatternContext): PatternResult;
17
19
  private identifyAssumptions;
18
20
  private identifyMissingContext;
@@ -1,11 +1,14 @@
1
- import { BasePattern } from './base-pattern.js';
1
+ import { BasePattern, } from './base-pattern.js';
2
2
  /**
3
- * v4.0 Deep Mode Pattern: Assumption Explicitizer
3
+ * v4.5 Pattern: Assumption Explicitizer
4
4
  *
5
5
  * Makes implicit assumptions explicit to prevent misunderstandings
6
6
  * and ensure comprehensive requirement coverage.
7
7
  */
8
8
  export class AssumptionExplicitizer extends BasePattern {
9
+ // -------------------------------------------------------------------------
10
+ // Pattern Metadata (v4.5 unified types)
11
+ // -------------------------------------------------------------------------
9
12
  id = 'assumption-explicitizer';
10
13
  name = 'Assumption Explicitizer';
11
14
  description = 'Make implicit assumptions explicit to prevent misunderstandings';
@@ -18,7 +21,27 @@ export class AssumptionExplicitizer extends BasePattern {
18
21
  'prd-generation',
19
22
  ];
20
23
  mode = 'deep';
21
- priority = 6;
24
+ priority = 6; // MEDIUM - standard enhancement
25
+ phases = ['all'];
26
+ // -------------------------------------------------------------------------
27
+ // Configuration Schema (v4.5)
28
+ // -------------------------------------------------------------------------
29
+ static configSchema = {
30
+ maxAssumptions: {
31
+ type: 'number',
32
+ default: 8,
33
+ description: 'Maximum number of assumptions to surface',
34
+ validation: { min: 1, max: 15 },
35
+ },
36
+ checkDomainAssumptions: {
37
+ type: 'boolean',
38
+ default: true,
39
+ description: 'Check for domain-specific assumptions (auth, API style, etc.)',
40
+ },
41
+ };
42
+ // -------------------------------------------------------------------------
43
+ // Pattern Application
44
+ // -------------------------------------------------------------------------
22
45
  apply(prompt, context) {
23
46
  const assumptions = this.identifyAssumptions(prompt, context.intent.primaryIntent);
24
47
  if (assumptions.length === 0) {