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.
- 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 +34 -12
- package/dist/core/intelligence/pattern-library.js +120 -85
- 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 +11 -9
- package/dist/core/intelligence/patterns/conversation-summarizer.js +40 -16
- 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 +11 -9
- package/dist/core/intelligence/patterns/implicit-requirement-extractor.js +27 -4
- 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 +11 -9
- package/dist/core/intelligence/patterns/topic-coherence-analyzer.js +22 -4
- 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/archive.md +1 -1
- package/dist/templates/slash-commands/_canonical/deep.md +5 -2
- package/dist/templates/slash-commands/_canonical/fast.md +10 -2
- package/dist/templates/slash-commands/_canonical/prd.md +4 -1
- package/dist/templates/slash-commands/_components/agent-protocols/assertion-checkpoints.md +122 -0
- package/dist/templates/slash-commands/_components/agent-protocols/decision-rules.md +29 -0
- package/dist/templates/slash-commands/_components/references/intent-types.md +3 -1
- package/dist/templates/slash-commands/_components/sections/pattern-visibility.md +14 -12
- package/package.json +1 -1
|
@@ -1,18 +1,20 @@
|
|
|
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: Dependency Identifier
|
|
5
5
|
*
|
|
6
6
|
* Identifies technical and external dependencies in PRD content.
|
|
7
7
|
* Helps surface hidden requirements and blockers.
|
|
8
8
|
*/
|
|
9
9
|
export declare class DependencyIdentifier extends BasePattern {
|
|
10
|
-
id
|
|
11
|
-
name
|
|
12
|
-
description
|
|
13
|
-
applicableIntents: PromptIntent[];
|
|
14
|
-
mode:
|
|
15
|
-
priority:
|
|
10
|
+
readonly id = "dependency-identifier";
|
|
11
|
+
readonly name = "Dependency Identifier";
|
|
12
|
+
readonly description = "Identifies technical and external dependencies";
|
|
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 hasDependencySection;
|
|
18
20
|
private identifyDependencies;
|
|
@@ -1,17 +1,34 @@
|
|
|
1
|
-
import { BasePattern } from './base-pattern.js';
|
|
1
|
+
import { BasePattern, } from './base-pattern.js';
|
|
2
2
|
/**
|
|
3
|
-
* v4.
|
|
3
|
+
* v4.5 Pattern: Dependency Identifier
|
|
4
4
|
*
|
|
5
5
|
* Identifies technical and external dependencies in PRD content.
|
|
6
6
|
* Helps surface hidden requirements and blockers.
|
|
7
7
|
*/
|
|
8
8
|
export class DependencyIdentifier extends BasePattern {
|
|
9
|
+
// -------------------------------------------------------------------------
|
|
10
|
+
// Pattern Metadata (v4.5 unified types)
|
|
11
|
+
// -------------------------------------------------------------------------
|
|
9
12
|
id = 'dependency-identifier';
|
|
10
|
-
name = '
|
|
13
|
+
name = 'Dependency Identifier';
|
|
11
14
|
description = 'Identifies technical and external dependencies';
|
|
12
15
|
applicableIntents = ['prd-generation', 'planning', 'migration'];
|
|
13
16
|
mode = 'deep';
|
|
14
|
-
priority = 5;
|
|
17
|
+
priority = 5; // MEDIUM-LOW - supplementary
|
|
18
|
+
phases = ['question-validation', 'output-generation'];
|
|
19
|
+
// -------------------------------------------------------------------------
|
|
20
|
+
// Configuration Schema (v4.5)
|
|
21
|
+
// -------------------------------------------------------------------------
|
|
22
|
+
static configSchema = {
|
|
23
|
+
categorizeDependencies: {
|
|
24
|
+
type: 'boolean',
|
|
25
|
+
default: true,
|
|
26
|
+
description: 'Separate technical from external dependencies',
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
// -------------------------------------------------------------------------
|
|
30
|
+
// Pattern Application
|
|
31
|
+
// -------------------------------------------------------------------------
|
|
15
32
|
apply(prompt, _context) {
|
|
16
33
|
// Check if dependencies are already documented
|
|
17
34
|
if (this.hasDependencySection(prompt)) {
|
|
@@ -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
|
-
*
|
|
4
|
+
* v4.5 Pattern: Domain Context Enricher
|
|
5
5
|
*
|
|
6
6
|
* Adds domain-specific context and best practices based on detected
|
|
7
7
|
* technical domain. Helps agents apply domain expertise.
|
|
8
8
|
*/
|
|
9
9
|
export declare class DomainContextEnricher extends BasePattern {
|
|
10
|
-
id
|
|
11
|
-
name
|
|
12
|
-
description
|
|
13
|
-
applicableIntents: PromptIntent[];
|
|
14
|
-
mode:
|
|
15
|
-
priority:
|
|
10
|
+
readonly id = "domain-context-enricher";
|
|
11
|
+
readonly name = "Domain Context Enricher";
|
|
12
|
+
readonly description = "Adds domain-specific best practices and context";
|
|
13
|
+
readonly applicableIntents: PromptIntent[];
|
|
14
|
+
readonly mode: PatternMode;
|
|
15
|
+
readonly priority: PatternPriority;
|
|
16
|
+
readonly phases: PatternPhase[];
|
|
17
|
+
static readonly configSchema: PatternConfigSchema;
|
|
16
18
|
private domainPatterns;
|
|
17
19
|
apply(prompt: string, _context: PatternContext): PatternResult;
|
|
18
20
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { BasePattern } from './base-pattern.js';
|
|
1
|
+
import { BasePattern, } from './base-pattern.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* v4.5 Pattern: Domain Context Enricher
|
|
4
4
|
*
|
|
5
5
|
* Adds domain-specific context and best practices based on detected
|
|
6
6
|
* technical domain. Helps agents apply domain expertise.
|
|
7
7
|
*/
|
|
8
8
|
export class DomainContextEnricher extends BasePattern {
|
|
9
|
+
// -------------------------------------------------------------------------
|
|
10
|
+
// Pattern Metadata (v4.5 unified types)
|
|
11
|
+
// -------------------------------------------------------------------------
|
|
9
12
|
id = 'domain-context-enricher';
|
|
10
13
|
name = 'Domain Context Enricher';
|
|
11
14
|
description = 'Adds domain-specific best practices and context';
|
|
@@ -19,7 +22,28 @@ export class DomainContextEnricher extends BasePattern {
|
|
|
19
22
|
'migration',
|
|
20
23
|
];
|
|
21
24
|
mode = 'both';
|
|
22
|
-
priority = 5; //
|
|
25
|
+
priority = 5; // MEDIUM-LOW - supplementary
|
|
26
|
+
phases = ['all'];
|
|
27
|
+
// -------------------------------------------------------------------------
|
|
28
|
+
// Configuration Schema (v4.5)
|
|
29
|
+
// -------------------------------------------------------------------------
|
|
30
|
+
static configSchema = {
|
|
31
|
+
maxDomains: {
|
|
32
|
+
type: 'number',
|
|
33
|
+
default: 2,
|
|
34
|
+
description: 'Maximum number of domains to detect',
|
|
35
|
+
validation: { min: 1, max: 4 },
|
|
36
|
+
},
|
|
37
|
+
practicesPerDomain: {
|
|
38
|
+
type: 'number',
|
|
39
|
+
default: 3,
|
|
40
|
+
description: 'Number of best practices per domain',
|
|
41
|
+
validation: { min: 1, max: 6 },
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
// -------------------------------------------------------------------------
|
|
45
|
+
// Pattern Data
|
|
46
|
+
// -------------------------------------------------------------------------
|
|
23
47
|
// Domain detection patterns
|
|
24
48
|
domainPatterns = {
|
|
25
49
|
authentication: {
|
|
@@ -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: Edge Case Identifier
|
|
5
5
|
*
|
|
6
6
|
* Identifies potential edge cases by domain/intent to ensure
|
|
7
7
|
* comprehensive requirement coverage.
|
|
8
8
|
*/
|
|
9
9
|
export declare class EdgeCaseIdentifier extends BasePattern {
|
|
10
|
-
id
|
|
11
|
-
name
|
|
12
|
-
description
|
|
13
|
-
applicableIntents: PromptIntent[];
|
|
14
|
-
mode:
|
|
15
|
-
priority:
|
|
10
|
+
readonly id = "edge-case-identifier";
|
|
11
|
+
readonly name = "Edge Case Identifier";
|
|
12
|
+
readonly description = "Identify potential edge cases and failure modes by domain";
|
|
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 identifyEdgeCases;
|
|
18
20
|
private getGeneralEdgeCases;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { BasePattern } from './base-pattern.js';
|
|
1
|
+
import { BasePattern, } from './base-pattern.js';
|
|
2
2
|
/**
|
|
3
|
-
* v4.
|
|
3
|
+
* v4.5 Pattern: Edge Case Identifier
|
|
4
4
|
*
|
|
5
5
|
* Identifies potential edge cases by domain/intent to ensure
|
|
6
6
|
* comprehensive requirement coverage.
|
|
7
7
|
*/
|
|
8
8
|
export class EdgeCaseIdentifier extends BasePattern {
|
|
9
|
+
// -------------------------------------------------------------------------
|
|
10
|
+
// Pattern Metadata (v4.5 unified types)
|
|
11
|
+
// -------------------------------------------------------------------------
|
|
9
12
|
id = 'edge-case-identifier';
|
|
10
13
|
name = 'Edge Case Identifier';
|
|
11
14
|
description = 'Identify potential edge cases and failure modes by domain';
|
|
@@ -17,7 +20,22 @@ export class EdgeCaseIdentifier extends BasePattern {
|
|
|
17
20
|
'security-review',
|
|
18
21
|
];
|
|
19
22
|
mode = 'deep';
|
|
20
|
-
priority = 4;
|
|
23
|
+
priority = 4; // LOW - polish phase
|
|
24
|
+
phases = ['all'];
|
|
25
|
+
// -------------------------------------------------------------------------
|
|
26
|
+
// Configuration Schema (v4.5)
|
|
27
|
+
// -------------------------------------------------------------------------
|
|
28
|
+
static configSchema = {
|
|
29
|
+
maxEdgeCases: {
|
|
30
|
+
type: 'number',
|
|
31
|
+
default: 8,
|
|
32
|
+
description: 'Maximum number of edge cases to identify',
|
|
33
|
+
validation: { min: 1, max: 15 },
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
// -------------------------------------------------------------------------
|
|
37
|
+
// Pattern Application
|
|
38
|
+
// -------------------------------------------------------------------------
|
|
21
39
|
apply(prompt, context) {
|
|
22
40
|
const edgeCases = this.identifyEdgeCases(prompt, context.intent.primaryIntent);
|
|
23
41
|
if (edgeCases.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
|
-
*
|
|
4
|
+
* v4.5 Pattern: Error Tolerance Enhancer
|
|
5
5
|
*
|
|
6
6
|
* Adds error handling requirements and considerations to prompts.
|
|
7
7
|
* Ensures implementations are robust and handle failure gracefully.
|
|
8
8
|
*/
|
|
9
9
|
export declare class ErrorToleranceEnhancer extends BasePattern {
|
|
10
|
-
id
|
|
11
|
-
name
|
|
12
|
-
description
|
|
13
|
-
applicableIntents: PromptIntent[];
|
|
14
|
-
mode:
|
|
15
|
-
priority:
|
|
10
|
+
readonly id = "error-tolerance-enhancer";
|
|
11
|
+
readonly name = "Error Tolerance Enhancer";
|
|
12
|
+
readonly description = "Adds error handling requirements and failure mode considerations";
|
|
13
|
+
readonly applicableIntents: PromptIntent[];
|
|
14
|
+
readonly mode: PatternMode;
|
|
15
|
+
readonly priority: PatternPriority;
|
|
16
|
+
readonly phases: PatternPhase[];
|
|
17
|
+
static readonly configSchema: PatternConfigSchema;
|
|
16
18
|
private errorIndicators;
|
|
17
19
|
private errorScenarios;
|
|
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
|
-
*
|
|
3
|
+
* v4.5 Pattern: Error Tolerance Enhancer
|
|
4
4
|
*
|
|
5
5
|
* Adds error handling requirements and considerations to prompts.
|
|
6
6
|
* Ensures implementations are robust and handle failure gracefully.
|
|
7
7
|
*/
|
|
8
8
|
export class ErrorToleranceEnhancer extends BasePattern {
|
|
9
|
+
// -------------------------------------------------------------------------
|
|
10
|
+
// Pattern Metadata (v4.5 unified types)
|
|
11
|
+
// -------------------------------------------------------------------------
|
|
9
12
|
id = 'error-tolerance-enhancer';
|
|
10
13
|
name = 'Error Tolerance Enhancer';
|
|
11
14
|
description = 'Adds error handling requirements and failure mode considerations';
|
|
@@ -16,8 +19,23 @@ export class ErrorToleranceEnhancer extends BasePattern {
|
|
|
16
19
|
'migration',
|
|
17
20
|
'testing',
|
|
18
21
|
];
|
|
19
|
-
mode = 'deep';
|
|
20
|
-
priority = 5; //
|
|
22
|
+
mode = 'deep';
|
|
23
|
+
priority = 5; // MEDIUM-LOW - supplementary
|
|
24
|
+
phases = ['all'];
|
|
25
|
+
// -------------------------------------------------------------------------
|
|
26
|
+
// Configuration Schema (v4.5)
|
|
27
|
+
// -------------------------------------------------------------------------
|
|
28
|
+
static configSchema = {
|
|
29
|
+
maxErrorScenarios: {
|
|
30
|
+
type: 'number',
|
|
31
|
+
default: 6,
|
|
32
|
+
description: 'Maximum number of error scenarios to surface',
|
|
33
|
+
validation: { min: 1, max: 10 },
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
// -------------------------------------------------------------------------
|
|
37
|
+
// Pattern Data
|
|
38
|
+
// -------------------------------------------------------------------------
|
|
21
39
|
// Indicators that error handling is already addressed
|
|
22
40
|
errorIndicators = [
|
|
23
41
|
'error handling',
|
|
@@ -1,19 +1,21 @@
|
|
|
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: Implicit Requirement Extractor
|
|
5
5
|
*
|
|
6
6
|
* Surfaces requirements mentioned indirectly in conversations.
|
|
7
7
|
* Identifies hidden assumptions and unstated needs.
|
|
8
8
|
* Enhanced with more detection patterns and categorization.
|
|
9
9
|
*/
|
|
10
10
|
export declare class ImplicitRequirementExtractor extends BasePattern {
|
|
11
|
-
id
|
|
12
|
-
name
|
|
13
|
-
description
|
|
14
|
-
applicableIntents: PromptIntent[];
|
|
15
|
-
mode:
|
|
16
|
-
priority:
|
|
11
|
+
readonly id = "implicit-requirement-extractor";
|
|
12
|
+
readonly name = "Implicit Requirement Extractor";
|
|
13
|
+
readonly description = "Surfaces requirements mentioned indirectly";
|
|
14
|
+
readonly applicableIntents: PromptIntent[];
|
|
15
|
+
readonly mode: PatternMode;
|
|
16
|
+
readonly priority: PatternPriority;
|
|
17
|
+
readonly phases: PatternPhase[];
|
|
18
|
+
static readonly configSchema: PatternConfigSchema;
|
|
17
19
|
private readonly implicitPatterns;
|
|
18
20
|
apply(prompt: string, _context: PatternContext): PatternResult;
|
|
19
21
|
private extractImplicitRequirements;
|
|
@@ -1,18 +1,41 @@
|
|
|
1
|
-
import { BasePattern } from './base-pattern.js';
|
|
1
|
+
import { BasePattern, } from './base-pattern.js';
|
|
2
2
|
/**
|
|
3
|
-
* v4.
|
|
3
|
+
* v4.5 Pattern: Implicit Requirement Extractor
|
|
4
4
|
*
|
|
5
5
|
* Surfaces requirements mentioned indirectly in conversations.
|
|
6
6
|
* Identifies hidden assumptions and unstated needs.
|
|
7
7
|
* Enhanced with more detection patterns and categorization.
|
|
8
8
|
*/
|
|
9
9
|
export class ImplicitRequirementExtractor extends BasePattern {
|
|
10
|
+
// -------------------------------------------------------------------------
|
|
11
|
+
// Pattern Metadata (v4.5 unified types)
|
|
12
|
+
// -------------------------------------------------------------------------
|
|
10
13
|
id = 'implicit-requirement-extractor';
|
|
11
|
-
name = '
|
|
14
|
+
name = 'Implicit Requirement Extractor';
|
|
12
15
|
description = 'Surfaces requirements mentioned indirectly';
|
|
13
16
|
applicableIntents = ['summarization', 'planning', 'prd-generation'];
|
|
14
17
|
mode = 'deep';
|
|
15
|
-
priority =
|
|
18
|
+
priority = 5; // MEDIUM-LOW - supplementary
|
|
19
|
+
phases = ['conversation-tracking', 'summarization'];
|
|
20
|
+
// -------------------------------------------------------------------------
|
|
21
|
+
// Configuration Schema (v4.5)
|
|
22
|
+
// -------------------------------------------------------------------------
|
|
23
|
+
static configSchema = {
|
|
24
|
+
maxImplicitRequirements: {
|
|
25
|
+
type: 'number',
|
|
26
|
+
default: 10,
|
|
27
|
+
description: 'Maximum number of implicit requirements to surface',
|
|
28
|
+
validation: { min: 1, max: 15 },
|
|
29
|
+
},
|
|
30
|
+
groupByCategory: {
|
|
31
|
+
type: 'boolean',
|
|
32
|
+
default: true,
|
|
33
|
+
description: 'Group requirements by category',
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
// -------------------------------------------------------------------------
|
|
37
|
+
// Pattern Data
|
|
38
|
+
// -------------------------------------------------------------------------
|
|
16
39
|
// Categories for implicit requirements
|
|
17
40
|
implicitPatterns = [
|
|
18
41
|
// Infrastructure requirements
|
|
@@ -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: Objective Clarifier
|
|
5
|
+
*
|
|
6
|
+
* Extracts or infers clear goal statement from prompts.
|
|
7
|
+
* Ensures every prompt has an explicit objective section.
|
|
8
|
+
*/
|
|
3
9
|
export declare class ObjectiveClarifier extends BasePattern {
|
|
4
|
-
id
|
|
5
|
-
name
|
|
6
|
-
description
|
|
7
|
-
applicableIntents: PromptIntent[];
|
|
8
|
-
mode:
|
|
9
|
-
priority:
|
|
10
|
+
readonly id = "objective-clarifier";
|
|
11
|
+
readonly name = "Objective Clarifier";
|
|
12
|
+
readonly description = "Extracts or infers clear goal statement";
|
|
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
|
private hasExplicitObjective;
|
|
12
20
|
private extractObjective;
|
|
@@ -1,11 +1,45 @@
|
|
|
1
|
-
import { BasePattern } from './base-pattern.js';
|
|
1
|
+
import { BasePattern, } from './base-pattern.js';
|
|
2
|
+
/**
|
|
3
|
+
* v4.5 Pattern: Objective Clarifier
|
|
4
|
+
*
|
|
5
|
+
* Extracts or infers clear goal statement from prompts.
|
|
6
|
+
* Ensures every prompt has an explicit objective section.
|
|
7
|
+
*/
|
|
2
8
|
export class ObjectiveClarifier extends BasePattern {
|
|
9
|
+
// -------------------------------------------------------------------------
|
|
10
|
+
// Pattern Metadata (v4.5 unified types)
|
|
11
|
+
// -------------------------------------------------------------------------
|
|
3
12
|
id = 'objective-clarifier';
|
|
4
13
|
name = 'Objective Clarifier';
|
|
5
14
|
description = 'Extracts or infers clear goal statement';
|
|
6
|
-
applicableIntents = [
|
|
15
|
+
applicableIntents = [
|
|
16
|
+
'code-generation',
|
|
17
|
+
'planning',
|
|
18
|
+
'refinement',
|
|
19
|
+
'debugging',
|
|
20
|
+
'documentation',
|
|
21
|
+
];
|
|
7
22
|
mode = 'both';
|
|
8
|
-
priority = 9;
|
|
23
|
+
priority = 9; // VERY HIGH - structural integrity
|
|
24
|
+
phases = ['all'];
|
|
25
|
+
// -------------------------------------------------------------------------
|
|
26
|
+
// Configuration Schema (v4.5)
|
|
27
|
+
// -------------------------------------------------------------------------
|
|
28
|
+
static configSchema = {
|
|
29
|
+
inferFromContext: {
|
|
30
|
+
type: 'boolean',
|
|
31
|
+
default: true,
|
|
32
|
+
description: 'Attempt to infer objective when not explicitly stated',
|
|
33
|
+
},
|
|
34
|
+
addHeaderPrefix: {
|
|
35
|
+
type: 'boolean',
|
|
36
|
+
default: true,
|
|
37
|
+
description: 'Add "# Objective" header prefix when adding objective',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
// -------------------------------------------------------------------------
|
|
41
|
+
// Pattern Application
|
|
42
|
+
// -------------------------------------------------------------------------
|
|
9
43
|
apply(prompt, context) {
|
|
10
44
|
// Check if prompt already has clear objective section
|
|
11
45
|
if (this.hasExplicitObjective(prompt)) {
|
|
@@ -14,9 +48,9 @@ export class ObjectiveClarifier extends BasePattern {
|
|
|
14
48
|
improvement: {
|
|
15
49
|
dimension: 'clarity',
|
|
16
50
|
description: 'Objective already clearly stated',
|
|
17
|
-
impact: 'low'
|
|
51
|
+
impact: 'low',
|
|
18
52
|
},
|
|
19
|
-
applied: false
|
|
53
|
+
applied: false,
|
|
20
54
|
};
|
|
21
55
|
}
|
|
22
56
|
// Extract or infer objective
|
|
@@ -28,9 +62,9 @@ export class ObjectiveClarifier extends BasePattern {
|
|
|
28
62
|
improvement: {
|
|
29
63
|
dimension: 'clarity',
|
|
30
64
|
description: 'Could not infer clear objective',
|
|
31
|
-
impact: 'low'
|
|
65
|
+
impact: 'low',
|
|
32
66
|
},
|
|
33
|
-
applied: false
|
|
67
|
+
applied: false,
|
|
34
68
|
};
|
|
35
69
|
}
|
|
36
70
|
// Add objective section
|
|
@@ -40,26 +74,21 @@ export class ObjectiveClarifier extends BasePattern {
|
|
|
40
74
|
improvement: {
|
|
41
75
|
dimension: 'clarity',
|
|
42
76
|
description: 'Added clear objective statement',
|
|
43
|
-
impact: 'high'
|
|
77
|
+
impact: 'high',
|
|
44
78
|
},
|
|
45
|
-
applied: true
|
|
79
|
+
applied: true,
|
|
46
80
|
};
|
|
47
81
|
}
|
|
48
82
|
hasExplicitObjective(prompt) {
|
|
49
|
-
const objectiveMarkers = [
|
|
50
|
-
|
|
51
|
-
/^objective:/im,
|
|
52
|
-
/^goal:/im,
|
|
53
|
-
/^purpose:/im
|
|
54
|
-
];
|
|
55
|
-
return objectiveMarkers.some(marker => marker.test(prompt));
|
|
83
|
+
const objectiveMarkers = [/^#+ objective/im, /^objective:/im, /^goal:/im, /^purpose:/im];
|
|
84
|
+
return objectiveMarkers.some((marker) => marker.test(prompt));
|
|
56
85
|
}
|
|
57
86
|
extractObjective(prompt, intent) {
|
|
58
87
|
const lowerPrompt = prompt.toLowerCase();
|
|
59
88
|
// Look for explicit goal statements
|
|
60
89
|
const goalPatterns = [
|
|
61
90
|
/(?:i need to|i want to|i'm trying to|goal is to|objective is to|purpose is to)\s+(.+?)(?:\.|$)/i,
|
|
62
|
-
/(?:create|build|make|implement|develop|write)\s+(.+?)(?:\.|$)/i
|
|
91
|
+
/(?:create|build|make|implement|develop|write)\s+(.+?)(?:\.|$)/i,
|
|
63
92
|
];
|
|
64
93
|
for (const pattern of goalPatterns) {
|
|
65
94
|
const match = prompt.match(pattern);
|
|
@@ -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
|
-
*
|
|
4
|
+
* v4.5 Pattern: Output Format Enforcer
|
|
5
5
|
*
|
|
6
6
|
* Ensures prompts specify the expected output format, which is critical
|
|
7
7
|
* for agent-first design - agents need to know exactly what to produce.
|
|
8
8
|
*/
|
|
9
9
|
export declare class OutputFormatEnforcer extends BasePattern {
|
|
10
|
-
id
|
|
11
|
-
name
|
|
12
|
-
description
|
|
13
|
-
applicableIntents: PromptIntent[];
|
|
14
|
-
mode:
|
|
15
|
-
priority:
|
|
10
|
+
readonly id = "output-format-enforcer";
|
|
11
|
+
readonly name = "Output Format Enforcer";
|
|
12
|
+
readonly description = "Adds explicit output format specifications for agent clarity";
|
|
13
|
+
readonly applicableIntents: PromptIntent[];
|
|
14
|
+
readonly mode: PatternMode;
|
|
15
|
+
readonly priority: PatternPriority;
|
|
16
|
+
readonly phases: PatternPhase[];
|
|
17
|
+
static readonly configSchema: PatternConfigSchema;
|
|
16
18
|
private formatIndicators;
|
|
17
19
|
private intentFormats;
|
|
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
|
-
*
|
|
3
|
+
* v4.5 Pattern: Output Format Enforcer
|
|
4
4
|
*
|
|
5
5
|
* Ensures prompts specify the expected output format, which is critical
|
|
6
6
|
* for agent-first design - agents need to know exactly what to produce.
|
|
7
7
|
*/
|
|
8
8
|
export class OutputFormatEnforcer extends BasePattern {
|
|
9
|
+
// -------------------------------------------------------------------------
|
|
10
|
+
// Pattern Metadata (v4.5 unified types)
|
|
11
|
+
// -------------------------------------------------------------------------
|
|
9
12
|
id = 'output-format-enforcer';
|
|
10
13
|
name = 'Output Format Enforcer';
|
|
11
14
|
description = 'Adds explicit output format specifications for agent clarity';
|
|
@@ -17,7 +20,21 @@ export class OutputFormatEnforcer extends BasePattern {
|
|
|
17
20
|
'testing',
|
|
18
21
|
];
|
|
19
22
|
mode = 'both';
|
|
20
|
-
priority = 7; //
|
|
23
|
+
priority = 7; // MEDIUM-HIGH - important enrichment
|
|
24
|
+
phases = ['all'];
|
|
25
|
+
// -------------------------------------------------------------------------
|
|
26
|
+
// Configuration Schema (v4.5)
|
|
27
|
+
// -------------------------------------------------------------------------
|
|
28
|
+
static configSchema = {
|
|
29
|
+
showFormatSuggestions: {
|
|
30
|
+
type: 'boolean',
|
|
31
|
+
default: true,
|
|
32
|
+
description: 'Show format suggestions based on intent',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
// -------------------------------------------------------------------------
|
|
36
|
+
// Pattern Data
|
|
37
|
+
// -------------------------------------------------------------------------
|
|
21
38
|
// Format indicators that suggest format is already specified
|
|
22
39
|
formatIndicators = [
|
|
23
40
|
'output format',
|
|
@@ -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: PRD Structure Enforcer
|
|
5
5
|
*
|
|
6
6
|
* Ensures PRD prompts include all necessary sections
|
|
7
7
|
* for comprehensive product requirement documentation.
|
|
8
8
|
*/
|
|
9
9
|
export declare class PRDStructureEnforcer extends BasePattern {
|
|
10
|
-
id
|
|
11
|
-
name
|
|
12
|
-
description
|
|
13
|
-
applicableIntents: PromptIntent[];
|
|
14
|
-
mode:
|
|
15
|
-
priority:
|
|
10
|
+
readonly id = "prd-structure-enforcer";
|
|
11
|
+
readonly name = "PRD Structure Enforcer";
|
|
12
|
+
readonly description = "Ensure PRD prompts include all necessary sections";
|
|
13
|
+
readonly applicableIntents: PromptIntent[];
|
|
14
|
+
readonly mode: PatternMode;
|
|
15
|
+
readonly priority: PatternPriority;
|
|
16
|
+
readonly phases: PatternPhase[];
|
|
17
|
+
static readonly configSchema: PatternConfigSchema;
|
|
16
18
|
private readonly PRD_SECTIONS;
|
|
17
19
|
apply(prompt: string, _context: PatternContext): PatternResult;
|
|
18
20
|
private analyzePRDCompleteness;
|
|
@@ -1,17 +1,39 @@
|
|
|
1
|
-
import { BasePattern } from './base-pattern.js';
|
|
1
|
+
import { BasePattern, } from './base-pattern.js';
|
|
2
2
|
/**
|
|
3
|
-
* v4.
|
|
3
|
+
* v4.5 Pattern: PRD Structure Enforcer
|
|
4
4
|
*
|
|
5
5
|
* Ensures PRD prompts include all necessary sections
|
|
6
6
|
* for comprehensive product requirement documentation.
|
|
7
7
|
*/
|
|
8
8
|
export class PRDStructureEnforcer extends BasePattern {
|
|
9
|
+
// -------------------------------------------------------------------------
|
|
10
|
+
// Pattern Metadata (v4.5 unified types)
|
|
11
|
+
// -------------------------------------------------------------------------
|
|
9
12
|
id = 'prd-structure-enforcer';
|
|
10
13
|
name = 'PRD Structure Enforcer';
|
|
11
14
|
description = 'Ensure PRD prompts include all necessary sections';
|
|
12
15
|
applicableIntents = ['prd-generation'];
|
|
13
16
|
mode = 'deep';
|
|
14
|
-
priority = 9;
|
|
17
|
+
priority = 9; // VERY HIGH - structural integrity
|
|
18
|
+
phases = ['question-validation', 'output-generation'];
|
|
19
|
+
// -------------------------------------------------------------------------
|
|
20
|
+
// Configuration Schema (v4.5)
|
|
21
|
+
// -------------------------------------------------------------------------
|
|
22
|
+
static configSchema = {
|
|
23
|
+
showCompletenessScore: {
|
|
24
|
+
type: 'boolean',
|
|
25
|
+
default: true,
|
|
26
|
+
description: 'Show PRD completeness percentage',
|
|
27
|
+
},
|
|
28
|
+
includeBestPractices: {
|
|
29
|
+
type: 'boolean',
|
|
30
|
+
default: true,
|
|
31
|
+
description: 'Include PRD best practices reminder',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
// -------------------------------------------------------------------------
|
|
35
|
+
// Pattern Data
|
|
36
|
+
// -------------------------------------------------------------------------
|
|
15
37
|
// Required PRD sections with their purposes
|
|
16
38
|
PRD_SECTIONS = [
|
|
17
39
|
{
|