clavix 4.3.2 → 4.5.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.
- package/dist/core/adapters/instructions-generator.d.ts +2 -1
- package/dist/core/adapters/instructions-generator.js +21 -8
- package/dist/core/intelligence/confidence-calculator.d.ts +93 -0
- package/dist/core/intelligence/confidence-calculator.js +124 -0
- package/dist/core/intelligence/index.d.ts +1 -0
- package/dist/core/intelligence/index.js +2 -0
- package/dist/core/intelligence/intent-detector.js +10 -8
- package/dist/core/intelligence/pattern-library.d.ts +47 -10
- package/dist/core/intelligence/pattern-library.js +151 -79
- package/dist/core/intelligence/patterns/actionability-enhancer.d.ts +10 -10
- package/dist/core/intelligence/patterns/actionability-enhancer.js +31 -6
- package/dist/core/intelligence/patterns/alternative-phrasing-generator.d.ts +10 -8
- package/dist/core/intelligence/patterns/alternative-phrasing-generator.js +21 -3
- package/dist/core/intelligence/patterns/ambiguity-detector.d.ts +10 -8
- package/dist/core/intelligence/patterns/ambiguity-detector.js +31 -3
- package/dist/core/intelligence/patterns/assumption-explicitizer.d.ts +10 -8
- package/dist/core/intelligence/patterns/assumption-explicitizer.js +26 -3
- package/dist/core/intelligence/patterns/base-pattern.d.ts +166 -8
- package/dist/core/intelligence/patterns/base-pattern.js +64 -4
- package/dist/core/intelligence/patterns/completeness-validator.d.ts +10 -10
- package/dist/core/intelligence/patterns/completeness-validator.js +26 -5
- package/dist/core/intelligence/patterns/conciseness-filter.d.ts +15 -7
- package/dist/core/intelligence/patterns/conciseness-filter.js +36 -4
- package/dist/core/intelligence/patterns/context-precision.d.ts +10 -8
- package/dist/core/intelligence/patterns/context-precision.js +28 -5
- package/dist/core/intelligence/patterns/conversation-summarizer.d.ts +14 -9
- package/dist/core/intelligence/patterns/conversation-summarizer.js +109 -29
- package/dist/core/intelligence/patterns/dependency-identifier.d.ts +11 -9
- package/dist/core/intelligence/patterns/dependency-identifier.js +21 -4
- package/dist/core/intelligence/patterns/domain-context-enricher.d.ts +10 -8
- package/dist/core/intelligence/patterns/domain-context-enricher.js +27 -3
- package/dist/core/intelligence/patterns/edge-case-identifier.d.ts +10 -8
- package/dist/core/intelligence/patterns/edge-case-identifier.js +21 -3
- package/dist/core/intelligence/patterns/error-tolerance-enhancer.d.ts +10 -8
- package/dist/core/intelligence/patterns/error-tolerance-enhancer.js +22 -4
- package/dist/core/intelligence/patterns/implicit-requirement-extractor.d.ts +14 -10
- package/dist/core/intelligence/patterns/implicit-requirement-extractor.js +193 -63
- package/dist/core/intelligence/patterns/objective-clarifier.d.ts +15 -7
- package/dist/core/intelligence/patterns/objective-clarifier.js +46 -17
- package/dist/core/intelligence/patterns/output-format-enforcer.d.ts +10 -8
- package/dist/core/intelligence/patterns/output-format-enforcer.js +20 -3
- package/dist/core/intelligence/patterns/prd-structure-enforcer.d.ts +10 -8
- package/dist/core/intelligence/patterns/prd-structure-enforcer.js +25 -3
- package/dist/core/intelligence/patterns/prerequisite-identifier.d.ts +10 -8
- package/dist/core/intelligence/patterns/prerequisite-identifier.js +28 -4
- package/dist/core/intelligence/patterns/requirement-prioritizer.d.ts +11 -9
- package/dist/core/intelligence/patterns/requirement-prioritizer.js +21 -4
- package/dist/core/intelligence/patterns/scope-definer.d.ts +10 -8
- package/dist/core/intelligence/patterns/scope-definer.js +27 -3
- package/dist/core/intelligence/patterns/step-decomposer.d.ts +10 -8
- package/dist/core/intelligence/patterns/step-decomposer.js +21 -3
- package/dist/core/intelligence/patterns/structure-organizer.d.ts +10 -10
- package/dist/core/intelligence/patterns/structure-organizer.js +25 -5
- package/dist/core/intelligence/patterns/success-criteria-enforcer.d.ts +10 -8
- package/dist/core/intelligence/patterns/success-criteria-enforcer.js +20 -3
- package/dist/core/intelligence/patterns/success-metrics-enforcer.d.ts +11 -9
- package/dist/core/intelligence/patterns/success-metrics-enforcer.js +27 -4
- package/dist/core/intelligence/patterns/technical-context-enricher.d.ts +16 -7
- package/dist/core/intelligence/patterns/technical-context-enricher.js +71 -38
- package/dist/core/intelligence/patterns/topic-coherence-analyzer.d.ts +13 -9
- package/dist/core/intelligence/patterns/topic-coherence-analyzer.js +202 -42
- package/dist/core/intelligence/patterns/user-persona-enricher.d.ts +11 -9
- package/dist/core/intelligence/patterns/user-persona-enricher.js +21 -4
- package/dist/core/intelligence/patterns/validation-checklist-creator.d.ts +11 -8
- package/dist/core/intelligence/patterns/validation-checklist-creator.js +31 -3
- package/dist/templates/slash-commands/_canonical/deep.md +1 -1
- package/dist/templates/slash-commands/_canonical/execute.md +1 -1
- package/dist/templates/slash-commands/_canonical/fast.md +1 -1
- package/dist/templates/slash-commands/_canonical/implement.md +1 -1
- package/dist/templates/slash-commands/_canonical/plan.md +1 -1
- package/dist/templates/slash-commands/_canonical/prd.md +1 -1
- package/dist/templates/slash-commands/_canonical/start.md +21 -1
- package/dist/templates/slash-commands/_canonical/summarize.md +43 -2
- package/dist/templates/slash-commands/_components/references/intent-types.md +3 -1
- package/dist/templates/slash-commands/_components/sections/pattern-visibility.md +9 -9
- package/dist/types/config.d.ts +24 -0
- package/package.json +1 -1
|
@@ -1,14 +1,172 @@
|
|
|
1
|
-
import { PromptIntent,
|
|
1
|
+
import { PromptIntent, PatternContext, PatternResult } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Pattern mode determines when a pattern is active.
|
|
4
|
+
* - 'fast': Only in fast optimization mode
|
|
5
|
+
* - 'deep': Only in deep analysis mode
|
|
6
|
+
* - 'both': Available in both modes
|
|
7
|
+
*/
|
|
8
|
+
export type PatternMode = 'fast' | 'deep' | 'both';
|
|
9
|
+
/**
|
|
10
|
+
* Pattern phases for PRD and Conversational modes.
|
|
11
|
+
* Patterns declare which phases they apply to.
|
|
12
|
+
*
|
|
13
|
+
* - 'question-validation': PRD mode - validating individual answers
|
|
14
|
+
* - 'output-generation': PRD mode - generating final PRD documents
|
|
15
|
+
* - 'conversation-tracking': Conversational mode - analyzing messages in real-time
|
|
16
|
+
* - 'summarization': Conversational mode - extracting requirements from conversation
|
|
17
|
+
* - 'all': Pattern applies to all phases (default for basic patterns)
|
|
18
|
+
*/
|
|
19
|
+
export type PatternPhase = 'question-validation' | 'output-generation' | 'conversation-tracking' | 'summarization' | 'all';
|
|
20
|
+
/**
|
|
21
|
+
* Pattern Priority Scale (1-10)
|
|
22
|
+
*
|
|
23
|
+
* Higher priority patterns run FIRST (sorted descending).
|
|
24
|
+
*
|
|
25
|
+
* 10: CRITICAL - Must run before everything else
|
|
26
|
+
* Use case: Mode detection, fundamental structure validation
|
|
27
|
+
*
|
|
28
|
+
* 9: VERY HIGH - Structural integrity
|
|
29
|
+
* Use case: Ambiguity detection, completeness validation, PRD structure
|
|
30
|
+
*
|
|
31
|
+
* 8: HIGH - Core enhancement
|
|
32
|
+
* Use case: Objective clarification, structure organization, summarization
|
|
33
|
+
*
|
|
34
|
+
* 7: MEDIUM-HIGH - Important enrichment
|
|
35
|
+
* Use case: Output format, success criteria, requirement prioritization
|
|
36
|
+
*
|
|
37
|
+
* 6: MEDIUM - Standard enhancement
|
|
38
|
+
* Use case: Context enrichment, topic coherence, user personas
|
|
39
|
+
*
|
|
40
|
+
* 5: MEDIUM-LOW - Supplementary
|
|
41
|
+
* Use case: Step decomposition, technical context, implicit requirements
|
|
42
|
+
*
|
|
43
|
+
* 4: LOW - Polish
|
|
44
|
+
* Use case: Conciseness filtering, actionability enhancement
|
|
45
|
+
*
|
|
46
|
+
* 3: VERY LOW - Final touches
|
|
47
|
+
* Use case: Phrasing alternatives, edge cases, validation checklists
|
|
48
|
+
*
|
|
49
|
+
* 2: MINIMAL - Only if nothing else applies
|
|
50
|
+
* Use case: Reserved for future
|
|
51
|
+
*
|
|
52
|
+
* 1: LOWEST - Last resort
|
|
53
|
+
* Use case: Reserved for future
|
|
54
|
+
*
|
|
55
|
+
* Collision Resolution: When priorities are equal, patterns run
|
|
56
|
+
* in registration order (first registered runs first).
|
|
57
|
+
*/
|
|
58
|
+
export type PatternPriority = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
|
|
59
|
+
/**
|
|
60
|
+
* Pattern dependency configuration.
|
|
61
|
+
* Allows patterns to express execution order constraints.
|
|
62
|
+
*/
|
|
63
|
+
export interface PatternDependency {
|
|
64
|
+
/**
|
|
65
|
+
* Patterns that must run before this one.
|
|
66
|
+
* Uses pattern IDs.
|
|
67
|
+
*/
|
|
68
|
+
runAfter?: string[];
|
|
69
|
+
/**
|
|
70
|
+
* Patterns that are mutually exclusive with this one.
|
|
71
|
+
* If one runs, the other won't.
|
|
72
|
+
*/
|
|
73
|
+
excludesWith?: string[];
|
|
74
|
+
/**
|
|
75
|
+
* Patterns that enhance this one when both run.
|
|
76
|
+
* Informational only, no enforcement.
|
|
77
|
+
*/
|
|
78
|
+
enhancedBy?: string[];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Schema field types for pattern configuration
|
|
82
|
+
*/
|
|
83
|
+
export type PatternConfigFieldType = 'string' | 'number' | 'boolean' | 'array' | 'enum';
|
|
84
|
+
/**
|
|
85
|
+
* Single field in a pattern's configuration schema
|
|
86
|
+
*/
|
|
87
|
+
export interface PatternConfigField {
|
|
88
|
+
type: PatternConfigFieldType;
|
|
89
|
+
default: unknown;
|
|
90
|
+
description: string;
|
|
91
|
+
validation?: {
|
|
92
|
+
min?: number;
|
|
93
|
+
max?: number;
|
|
94
|
+
enum?: string[];
|
|
95
|
+
minLength?: number;
|
|
96
|
+
maxLength?: number;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Configuration schema for a pattern.
|
|
101
|
+
* Each pattern declares its configurable options.
|
|
102
|
+
* Empty object `{}` means no configuration available.
|
|
103
|
+
*/
|
|
104
|
+
export interface PatternConfigSchema {
|
|
105
|
+
[fieldName: string]: PatternConfigField;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Interface for PatternLibrary to avoid circular dependency.
|
|
109
|
+
* Used by patterns to access their configuration.
|
|
110
|
+
*/
|
|
111
|
+
export interface IPatternLibrary {
|
|
112
|
+
getPatternSettings(patternId: string): Record<string, unknown> | undefined;
|
|
113
|
+
}
|
|
2
114
|
export declare abstract class BasePattern {
|
|
3
|
-
|
|
4
|
-
abstract
|
|
5
|
-
|
|
6
|
-
abstract
|
|
7
|
-
|
|
8
|
-
abstract
|
|
115
|
+
/** Unique identifier for this pattern (e.g., 'conciseness-filter') */
|
|
116
|
+
abstract readonly id: string;
|
|
117
|
+
/** Human-readable name (e.g., 'Conciseness Filter') */
|
|
118
|
+
abstract readonly name: string;
|
|
119
|
+
/** Brief description of what this pattern does */
|
|
120
|
+
abstract readonly description: string;
|
|
121
|
+
/** Which intents this pattern is applicable to */
|
|
122
|
+
abstract readonly applicableIntents: PromptIntent[];
|
|
123
|
+
/** Which mode(s) this pattern runs in */
|
|
124
|
+
abstract readonly mode: PatternMode;
|
|
125
|
+
/** Execution priority (1-10, higher runs first) */
|
|
126
|
+
abstract readonly priority: PatternPriority;
|
|
127
|
+
/** Which phases this pattern applies to (PRD/conversational modes) */
|
|
128
|
+
abstract readonly phases: PatternPhase[];
|
|
129
|
+
/** Optional dependency configuration */
|
|
130
|
+
readonly dependencies?: PatternDependency;
|
|
131
|
+
/**
|
|
132
|
+
* Configuration schema for this pattern.
|
|
133
|
+
* Override in subclass to define configurable options.
|
|
134
|
+
* Empty object means no configuration available.
|
|
135
|
+
*/
|
|
136
|
+
static readonly configSchema: PatternConfigSchema;
|
|
137
|
+
/**
|
|
138
|
+
* Reference to pattern library for accessing configuration.
|
|
139
|
+
* Injected by PatternLibrary on registration.
|
|
140
|
+
*/
|
|
141
|
+
private patternLibraryRef?;
|
|
142
|
+
/**
|
|
143
|
+
* Inject PatternLibrary reference for config access.
|
|
144
|
+
* Called by PatternLibrary during registration.
|
|
145
|
+
*/
|
|
146
|
+
setPatternLibrary(library: IPatternLibrary): void;
|
|
147
|
+
/**
|
|
148
|
+
* Get settings for this pattern with defaults applied.
|
|
149
|
+
* Use in apply() method to access user configuration.
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```typescript
|
|
153
|
+
* apply(prompt: string, context: PatternContext): PatternResult {
|
|
154
|
+
* const settings = this.getSettings();
|
|
155
|
+
* if (fluffCount > settings.fluffThreshold) {
|
|
156
|
+
* // ...
|
|
157
|
+
* }
|
|
158
|
+
* }
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
protected getSettings(): Record<string, unknown>;
|
|
162
|
+
/**
|
|
163
|
+
* Apply this pattern to the given prompt.
|
|
164
|
+
* Must be implemented by all concrete patterns.
|
|
165
|
+
*/
|
|
9
166
|
abstract apply(prompt: string, context: PatternContext): PatternResult;
|
|
10
167
|
/**
|
|
11
|
-
* Check if this pattern is applicable for the given context
|
|
168
|
+
* Check if this pattern is applicable for the given context.
|
|
169
|
+
* Can be overridden for custom applicability logic.
|
|
12
170
|
*/
|
|
13
171
|
isApplicable(context: PatternContext): boolean;
|
|
14
172
|
/**
|
|
@@ -1,6 +1,63 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Base Pattern Abstract Class
|
|
3
|
+
// ============================================================================
|
|
1
4
|
export class BasePattern {
|
|
5
|
+
// -------------------------------------------------------------------------
|
|
6
|
+
// Optional Pattern Metadata
|
|
7
|
+
// -------------------------------------------------------------------------
|
|
8
|
+
/** Optional dependency configuration */
|
|
9
|
+
dependencies;
|
|
10
|
+
// -------------------------------------------------------------------------
|
|
11
|
+
// Configuration Support (v4.5)
|
|
12
|
+
// -------------------------------------------------------------------------
|
|
2
13
|
/**
|
|
3
|
-
*
|
|
14
|
+
* Configuration schema for this pattern.
|
|
15
|
+
* Override in subclass to define configurable options.
|
|
16
|
+
* Empty object means no configuration available.
|
|
17
|
+
*/
|
|
18
|
+
static configSchema = {};
|
|
19
|
+
/**
|
|
20
|
+
* Reference to pattern library for accessing configuration.
|
|
21
|
+
* Injected by PatternLibrary on registration.
|
|
22
|
+
*/
|
|
23
|
+
patternLibraryRef;
|
|
24
|
+
/**
|
|
25
|
+
* Inject PatternLibrary reference for config access.
|
|
26
|
+
* Called by PatternLibrary during registration.
|
|
27
|
+
*/
|
|
28
|
+
setPatternLibrary(library) {
|
|
29
|
+
this.patternLibraryRef = library;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get settings for this pattern with defaults applied.
|
|
33
|
+
* Use in apply() method to access user configuration.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* apply(prompt: string, context: PatternContext): PatternResult {
|
|
38
|
+
* const settings = this.getSettings();
|
|
39
|
+
* if (fluffCount > settings.fluffThreshold) {
|
|
40
|
+
* // ...
|
|
41
|
+
* }
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
getSettings() {
|
|
46
|
+
// Get the static configSchema from the concrete class
|
|
47
|
+
const ConcreteClass = this.constructor;
|
|
48
|
+
const schema = ConcreteClass.configSchema;
|
|
49
|
+
// Build defaults from schema
|
|
50
|
+
const defaults = {};
|
|
51
|
+
for (const [key, field] of Object.entries(schema)) {
|
|
52
|
+
defaults[key] = field.default;
|
|
53
|
+
}
|
|
54
|
+
// Merge with user config (user config overrides defaults)
|
|
55
|
+
const userConfig = this.patternLibraryRef?.getPatternSettings(this.id) || {};
|
|
56
|
+
return { ...defaults, ...userConfig };
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Check if this pattern is applicable for the given context.
|
|
60
|
+
* Can be overridden for custom applicability logic.
|
|
4
61
|
*/
|
|
5
62
|
isApplicable(context) {
|
|
6
63
|
// Check mode compatibility
|
|
@@ -10,6 +67,9 @@ export class BasePattern {
|
|
|
10
67
|
// Check intent compatibility
|
|
11
68
|
return this.applicableIntents.includes(context.intent.primaryIntent);
|
|
12
69
|
}
|
|
70
|
+
// -------------------------------------------------------------------------
|
|
71
|
+
// Utility Methods
|
|
72
|
+
// -------------------------------------------------------------------------
|
|
13
73
|
/**
|
|
14
74
|
* Utility: Remove extra whitespace
|
|
15
75
|
*/
|
|
@@ -21,19 +81,19 @@ export class BasePattern {
|
|
|
21
81
|
*/
|
|
22
82
|
hasSection(prompt, keywords) {
|
|
23
83
|
const lowerPrompt = prompt.toLowerCase();
|
|
24
|
-
return keywords.some(keyword => lowerPrompt.includes(keyword.toLowerCase()));
|
|
84
|
+
return keywords.some((keyword) => lowerPrompt.includes(keyword.toLowerCase()));
|
|
25
85
|
}
|
|
26
86
|
/**
|
|
27
87
|
* Utility: Count words
|
|
28
88
|
*/
|
|
29
89
|
countWords(text) {
|
|
30
|
-
return text.split(/\s+/).filter(word => word.length > 0).length;
|
|
90
|
+
return text.split(/\s+/).filter((word) => word.length > 0).length;
|
|
31
91
|
}
|
|
32
92
|
/**
|
|
33
93
|
* Utility: Extract sentences
|
|
34
94
|
*/
|
|
35
95
|
extractSentences(text) {
|
|
36
|
-
return text.split(/[.!?]+/).filter(s => s.trim().length > 0);
|
|
96
|
+
return text.split(/[.!?]+/).filter((s) => s.trim().length > 0);
|
|
37
97
|
}
|
|
38
98
|
}
|
|
39
99
|
//# sourceMappingURL=base-pattern.js.map
|
|
@@ -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
|
-
* Completeness Validator
|
|
4
|
+
* v4.5 Pattern: Completeness Validator
|
|
5
5
|
*
|
|
6
6
|
* Ensures all necessary requirements are present.
|
|
7
7
|
* Adds placeholder sections for missing critical elements.
|
|
8
|
-
*
|
|
9
|
-
* Priority: MEDIUM (6)
|
|
10
8
|
*/
|
|
11
9
|
export declare class CompletenessValidator extends BasePattern {
|
|
12
|
-
id
|
|
13
|
-
name
|
|
14
|
-
description
|
|
15
|
-
applicableIntents: PromptIntent[];
|
|
16
|
-
mode:
|
|
17
|
-
priority:
|
|
10
|
+
readonly id = "completeness-validator";
|
|
11
|
+
readonly name = "Completeness Validator";
|
|
12
|
+
readonly description = "Ensures all necessary requirements are present";
|
|
13
|
+
readonly applicableIntents: PromptIntent[];
|
|
14
|
+
readonly mode: PatternMode;
|
|
15
|
+
readonly priority: PatternPriority;
|
|
16
|
+
readonly phases: PatternPhase[];
|
|
17
|
+
static readonly configSchema: PatternConfigSchema;
|
|
18
18
|
apply(prompt: string, _context: PatternContext): PatternResult;
|
|
19
19
|
private findMissingElements;
|
|
20
20
|
private hasObjective;
|
|
@@ -1,19 +1,40 @@
|
|
|
1
|
-
import { BasePattern } from './base-pattern.js';
|
|
1
|
+
import { BasePattern, } from './base-pattern.js';
|
|
2
2
|
/**
|
|
3
|
-
* Completeness Validator
|
|
3
|
+
* v4.5 Pattern: Completeness Validator
|
|
4
4
|
*
|
|
5
5
|
* Ensures all necessary requirements are present.
|
|
6
6
|
* Adds placeholder sections for missing critical elements.
|
|
7
|
-
*
|
|
8
|
-
* Priority: MEDIUM (6)
|
|
9
7
|
*/
|
|
10
8
|
export class CompletenessValidator extends BasePattern {
|
|
9
|
+
// -------------------------------------------------------------------------
|
|
10
|
+
// Pattern Metadata (v4.5 unified types)
|
|
11
|
+
// -------------------------------------------------------------------------
|
|
11
12
|
id = 'completeness-validator';
|
|
12
13
|
name = 'Completeness Validator';
|
|
13
14
|
description = 'Ensures all necessary requirements are present';
|
|
14
15
|
applicableIntents = ['code-generation', 'planning', 'refinement'];
|
|
15
16
|
mode = 'both';
|
|
16
|
-
priority = 6; //
|
|
17
|
+
priority = 6; // MEDIUM - standard enhancement
|
|
18
|
+
phases = ['all'];
|
|
19
|
+
// -------------------------------------------------------------------------
|
|
20
|
+
// Configuration Schema (v4.5)
|
|
21
|
+
// -------------------------------------------------------------------------
|
|
22
|
+
static configSchema = {
|
|
23
|
+
showCompletenessScore: {
|
|
24
|
+
type: 'boolean',
|
|
25
|
+
default: true,
|
|
26
|
+
description: 'Display completeness percentage in output',
|
|
27
|
+
},
|
|
28
|
+
minCompletenessThreshold: {
|
|
29
|
+
type: 'number',
|
|
30
|
+
default: 60,
|
|
31
|
+
description: 'Minimum completeness percentage to consider prompt adequate',
|
|
32
|
+
validation: { min: 0, max: 100 },
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
// -------------------------------------------------------------------------
|
|
36
|
+
// Pattern Application
|
|
37
|
+
// -------------------------------------------------------------------------
|
|
17
38
|
apply(prompt, _context) {
|
|
18
39
|
const missing = this.findMissingElements(prompt);
|
|
19
40
|
if (missing.length === 0) {
|
|
@@ -1,12 +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
|
+
/**
|
|
4
|
+
* v4.5 Pattern: Conciseness Filter
|
|
5
|
+
*
|
|
6
|
+
* Removes unnecessary pleasantries, fluff words, and redundancy
|
|
7
|
+
* to make prompts more direct and efficient.
|
|
8
|
+
*/
|
|
3
9
|
export declare class ConcisenessFilter extends BasePattern {
|
|
4
|
-
id
|
|
5
|
-
name
|
|
6
|
-
description
|
|
7
|
-
applicableIntents: PromptIntent[];
|
|
8
|
-
mode:
|
|
9
|
-
priority:
|
|
10
|
+
readonly id = "conciseness-filter";
|
|
11
|
+
readonly name = "Conciseness Filter";
|
|
12
|
+
readonly description = "Removes unnecessary pleasantries, fluff words, and redundancy";
|
|
13
|
+
readonly applicableIntents: PromptIntent[];
|
|
14
|
+
readonly mode: PatternMode;
|
|
15
|
+
readonly priority: PatternPriority;
|
|
16
|
+
readonly phases: PatternPhase[];
|
|
17
|
+
static readonly configSchema: PatternConfigSchema;
|
|
10
18
|
apply(prompt: string, _context: PatternContext): PatternResult;
|
|
11
19
|
}
|
|
12
20
|
//# sourceMappingURL=conciseness-filter.d.ts.map
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import { BasePattern } from './base-pattern.js';
|
|
1
|
+
import { BasePattern, } from './base-pattern.js';
|
|
2
|
+
/**
|
|
3
|
+
* v4.5 Pattern: Conciseness Filter
|
|
4
|
+
*
|
|
5
|
+
* Removes unnecessary pleasantries, fluff words, and redundancy
|
|
6
|
+
* to make prompts more direct and efficient.
|
|
7
|
+
*/
|
|
2
8
|
export class ConcisenessFilter extends BasePattern {
|
|
9
|
+
// -------------------------------------------------------------------------
|
|
10
|
+
// Pattern Metadata (v4.5 unified types)
|
|
11
|
+
// -------------------------------------------------------------------------
|
|
3
12
|
id = 'conciseness-filter';
|
|
4
13
|
name = 'Conciseness Filter';
|
|
5
14
|
description = 'Removes unnecessary pleasantries, fluff words, and redundancy';
|
|
@@ -11,8 +20,30 @@ export class ConcisenessFilter extends BasePattern {
|
|
|
11
20
|
'documentation',
|
|
12
21
|
];
|
|
13
22
|
mode = 'both';
|
|
14
|
-
priority =
|
|
23
|
+
priority = 4; // LOW - Polish phase
|
|
24
|
+
phases = ['all'];
|
|
25
|
+
// -------------------------------------------------------------------------
|
|
26
|
+
// Configuration Schema (v4.5)
|
|
27
|
+
// -------------------------------------------------------------------------
|
|
28
|
+
static configSchema = {
|
|
29
|
+
fluffThreshold: {
|
|
30
|
+
type: 'number',
|
|
31
|
+
default: 3,
|
|
32
|
+
description: 'Number of fluff words to tolerate before applying filter',
|
|
33
|
+
validation: { min: 1, max: 10 },
|
|
34
|
+
},
|
|
35
|
+
preserveTechnicalTerms: {
|
|
36
|
+
type: 'boolean',
|
|
37
|
+
default: true,
|
|
38
|
+
description: 'Keep technical terms even if they appear verbose',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
// -------------------------------------------------------------------------
|
|
42
|
+
// Pattern Application
|
|
43
|
+
// -------------------------------------------------------------------------
|
|
15
44
|
apply(prompt, _context) {
|
|
45
|
+
const settings = this.getSettings();
|
|
46
|
+
const fluffThreshold = settings.fluffThreshold ?? 3;
|
|
16
47
|
let cleaned = prompt;
|
|
17
48
|
let changesCount = 0;
|
|
18
49
|
// Remove pleasantries at start
|
|
@@ -45,9 +76,10 @@ export class ConcisenessFilter extends BasePattern {
|
|
|
45
76
|
cleaned = cleaned.replace(/in the event that/gi, 'if');
|
|
46
77
|
// Clean up extra whitespace
|
|
47
78
|
cleaned = this.cleanWhitespace(cleaned);
|
|
48
|
-
|
|
79
|
+
// Only apply if changes exceed threshold
|
|
80
|
+
const applied = changesCount >= fluffThreshold || cleaned !== prompt;
|
|
49
81
|
return {
|
|
50
|
-
enhancedPrompt: cleaned,
|
|
82
|
+
enhancedPrompt: applied ? cleaned : prompt,
|
|
51
83
|
improvement: {
|
|
52
84
|
dimension: 'efficiency',
|
|
53
85
|
description: `Removed ${changesCount} unnecessary phrases for conciseness`,
|
|
@@ -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.
|
|
4
|
+
* v4.5 Pattern: Context Precision Booster
|
|
5
5
|
*
|
|
6
6
|
* Adds precise context when missing to ensure
|
|
7
7
|
* the AI has sufficient information for accurate responses.
|
|
8
8
|
*/
|
|
9
9
|
export declare class ContextPrecisionBooster extends BasePattern {
|
|
10
|
-
id
|
|
11
|
-
name
|
|
12
|
-
description
|
|
13
|
-
applicableIntents: PromptIntent[];
|
|
14
|
-
mode:
|
|
15
|
-
priority:
|
|
10
|
+
readonly id = "context-precision";
|
|
11
|
+
readonly name = "Context Precision Booster";
|
|
12
|
+
readonly description = "Add precise context when missing";
|
|
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 identifyMissingContext;
|
|
18
20
|
private checkGeneralContext;
|
|
@@ -1,25 +1,48 @@
|
|
|
1
|
-
import { BasePattern } from './base-pattern.js';
|
|
1
|
+
import { BasePattern, } from './base-pattern.js';
|
|
2
2
|
/**
|
|
3
|
-
* v4.
|
|
3
|
+
* v4.5 Pattern: Context Precision Booster
|
|
4
4
|
*
|
|
5
5
|
* Adds precise context when missing to ensure
|
|
6
6
|
* the AI has sufficient information for accurate responses.
|
|
7
7
|
*/
|
|
8
8
|
export class ContextPrecisionBooster extends BasePattern {
|
|
9
|
+
// -------------------------------------------------------------------------
|
|
10
|
+
// Pattern Metadata (v4.5 unified types)
|
|
11
|
+
// -------------------------------------------------------------------------
|
|
9
12
|
id = 'context-precision';
|
|
10
13
|
name = 'Context Precision Booster';
|
|
11
14
|
description = 'Add precise context when missing';
|
|
12
15
|
applicableIntents = [
|
|
13
16
|
'code-generation',
|
|
14
17
|
'debugging',
|
|
15
|
-
'refinement',
|
|
16
|
-
'documentation',
|
|
18
|
+
'refinement',
|
|
19
|
+
'documentation',
|
|
17
20
|
'testing',
|
|
18
21
|
'migration',
|
|
19
22
|
'security-review',
|
|
20
23
|
];
|
|
21
24
|
mode = 'both';
|
|
22
|
-
priority =
|
|
25
|
+
priority = 6; // MEDIUM - standard enhancement
|
|
26
|
+
phases = ['all'];
|
|
27
|
+
// -------------------------------------------------------------------------
|
|
28
|
+
// Configuration Schema (v4.5)
|
|
29
|
+
// -------------------------------------------------------------------------
|
|
30
|
+
static configSchema = {
|
|
31
|
+
maxContextGaps: {
|
|
32
|
+
type: 'number',
|
|
33
|
+
default: 6,
|
|
34
|
+
description: 'Maximum number of context gaps to surface',
|
|
35
|
+
validation: { min: 1, max: 10 },
|
|
36
|
+
},
|
|
37
|
+
checkVersionInfo: {
|
|
38
|
+
type: 'boolean',
|
|
39
|
+
default: true,
|
|
40
|
+
description: 'Check for missing version information',
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
// -------------------------------------------------------------------------
|
|
44
|
+
// Pattern Application
|
|
45
|
+
// -------------------------------------------------------------------------
|
|
23
46
|
apply(prompt, context) {
|
|
24
47
|
const missingContext = this.identifyMissingContext(prompt, context.intent.primaryIntent);
|
|
25
48
|
if (missingContext.length === 0) {
|
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
import { BasePattern } from './base-pattern.js';
|
|
2
|
-
import { PromptIntent,
|
|
1
|
+
import { BasePattern, PatternMode, PatternPriority, PatternPhase, PatternConfigSchema } from './base-pattern.js';
|
|
2
|
+
import { PromptIntent, PatternContext, PatternResult } from '../types.js';
|
|
3
3
|
/**
|
|
4
|
-
* v4.
|
|
4
|
+
* v4.5 Pattern: Conversation Summarizer
|
|
5
5
|
*
|
|
6
6
|
* Extracts structured requirements from conversational messages.
|
|
7
7
|
* Organizes free-form discussion into actionable requirements.
|
|
8
|
+
* Enhanced with expanded marker detection and confidence scoring.
|
|
8
9
|
*/
|
|
9
10
|
export declare class ConversationSummarizer extends BasePattern {
|
|
10
|
-
id
|
|
11
|
-
name
|
|
12
|
-
description
|
|
13
|
-
applicableIntents: PromptIntent[];
|
|
14
|
-
mode:
|
|
15
|
-
priority:
|
|
11
|
+
readonly id = "conversation-summarizer";
|
|
12
|
+
readonly name = "Conversation Summarizer";
|
|
13
|
+
readonly description = "Extracts structured requirements from messages";
|
|
14
|
+
readonly applicableIntents: PromptIntent[];
|
|
15
|
+
readonly mode: PatternMode;
|
|
16
|
+
readonly priority: PatternPriority;
|
|
17
|
+
readonly phases: PatternPhase[];
|
|
18
|
+
static readonly configSchema: PatternConfigSchema;
|
|
19
|
+
private readonly conversationalMarkers;
|
|
16
20
|
apply(prompt: string, _context: PatternContext): PatternResult;
|
|
17
21
|
private isAlreadyStructured;
|
|
18
22
|
private isConversationalContent;
|
|
23
|
+
private calculateConfidence;
|
|
19
24
|
private extractAndStructure;
|
|
20
25
|
private extractRequirements;
|
|
21
26
|
private extractConstraints;
|