clavix 4.11.2 → 4.12.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/README.md +31 -27
- package/dist/cli/commands/update.js +9 -10
- package/dist/core/intelligence/pattern-library.js +13 -22
- package/dist/core/intelligence/quality-assessor.d.ts +20 -0
- package/dist/core/intelligence/quality-assessor.js +21 -1
- package/dist/core/intelligence/universal-optimizer.d.ts +8 -1
- package/dist/core/intelligence/universal-optimizer.js +46 -18
- package/dist/templates/agents/agents.md +14 -8
- package/dist/templates/agents/copilot-instructions.md +1 -1
- package/dist/templates/instructions/core/verification.md +2 -2
- package/dist/templates/slash-commands/_canonical/improve.md +1 -1
- package/dist/templates/slash-commands/_canonical/start.md +1 -1
- package/dist/templates/slash-commands/_canonical/summarize.md +8 -8
- package/dist/templates/slash-commands/_components/agent-protocols/state-assertion.md +1 -1
- package/dist/templates/slash-commands/_components/references/intent-types.md +1 -1
- package/dist/templates/slash-commands/_components/sections/pattern-visibility.md +29 -46
- package/dist/types/config.d.ts +57 -0
- package/dist/utils/legacy-command-cleanup.js +31 -4
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Clavix
|
|
2
|
-
>
|
|
2
|
+
> Prompt optimization for AI coding. Transform rough ideas into structured, actionable prompts using pattern-based analysis—no framework to learn.
|
|
3
3
|
|
|
4
4
|
## Table of contents
|
|
5
5
|
- [Why Clavix?](#why-clavix)
|
|
@@ -20,24 +20,26 @@
|
|
|
20
20
|
**Requirements:** Node.js ≥ 16.0.0 (ESM support required)
|
|
21
21
|
|
|
22
22
|
## Why Clavix?
|
|
23
|
-
Better prompts lead to better code. Clavix
|
|
23
|
+
Better prompts lead to better code. Clavix analyzes what you're trying to do and applies structured optimization patterns—no framework to learn, no methodology to master. Just describe what you want, and Clavix structures it for AI consumption.
|
|
24
24
|
|
|
25
|
-
**What
|
|
26
|
-
- **
|
|
27
|
-
- **
|
|
28
|
-
- **
|
|
29
|
-
- **Universal
|
|
25
|
+
**What Clavix provides:**
|
|
26
|
+
- **Pattern-based intent detection** - Weighted keyword scoring across 11 intent categories
|
|
27
|
+
- **20 optimization patterns** - Automatically applied based on intent and quality assessment
|
|
28
|
+
- **Workflow management** - PRD generation, task breakdown, and implementation tracking
|
|
29
|
+
- **Universal integration** - Supports 20+ AI coding assistants with native slash commands
|
|
30
30
|
|
|
31
31
|
Learn more in [docs/why-clavix.md](docs/why-clavix.md).
|
|
32
32
|
|
|
33
33
|
## How It Works
|
|
34
|
-
Clavix uses
|
|
35
|
-
- **Detect intent** -
|
|
36
|
-
- **Assess quality** -
|
|
37
|
-
- **Apply patterns** -
|
|
38
|
-
- **Generate output** -
|
|
34
|
+
Clavix uses pattern-based analysis to:
|
|
35
|
+
- **Detect intent** - Keyword scoring and phrase detection across 11 intent categories
|
|
36
|
+
- **Assess quality** - Heuristic scoring across 6 dimensions: Clarity, Efficiency, Structure, Completeness, Actionability, Specificity
|
|
37
|
+
- **Apply patterns** - 20 optimization patterns automatically selected based on intent and quality
|
|
38
|
+
- **Generate output** - Structured prompts optimized for AI coding assistants
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
Optimization applies automatically—no frameworks to learn, no manual analysis required. Just describe what you want in plain language, and Clavix structures it into an AI-ready prompt.
|
|
41
|
+
|
|
42
|
+
See [docs/philosophy.md](docs/philosophy.md) for an honest look at what Clavix is and isn't.
|
|
41
43
|
|
|
42
44
|
## Providers
|
|
43
45
|
|
|
@@ -55,11 +57,12 @@ Provider paths and argument placeholders are listed in [docs/integrations.md](do
|
|
|
55
57
|
|
|
56
58
|
Most Clavix users work through AI coding assistants:
|
|
57
59
|
|
|
58
|
-
> **💡 Choosing Your
|
|
59
|
-
> - **
|
|
60
|
-
> - **PRD** –
|
|
60
|
+
> **💡 Choosing Your Workflow:**
|
|
61
|
+
> - **Improve** – Optimize a single prompt (auto-selects depth)
|
|
62
|
+
> - **PRD** – Plan something new with guided questions
|
|
63
|
+
> - **Start** – Explore ideas conversationally
|
|
61
64
|
>
|
|
62
|
-
> See [Choosing the Right
|
|
65
|
+
> See [Choosing the Right Workflow](docs/guides/choosing-workflow.md) for detailed guidance.
|
|
63
66
|
|
|
64
67
|
```bash
|
|
65
68
|
# 1. Initialize in your project
|
|
@@ -67,23 +70,23 @@ npm install -g clavix
|
|
|
67
70
|
clavix init
|
|
68
71
|
|
|
69
72
|
# 2. Use slash commands in your AI agent
|
|
70
|
-
/clavix:
|
|
71
|
-
/clavix:
|
|
72
|
-
/clavix:
|
|
73
|
+
/clavix:improve "Create a login page" # Optimize a prompt
|
|
74
|
+
/clavix:prd # Full PRD workflow
|
|
75
|
+
/clavix:start # Conversational exploration
|
|
73
76
|
|
|
74
77
|
# 3. Manage saved prompts
|
|
75
78
|
/clavix:execute # Execute saved prompts
|
|
76
|
-
/clavix:
|
|
79
|
+
/clavix:verify # Verify implementation against checklist
|
|
77
80
|
|
|
78
81
|
# 4. Implement with task tracking
|
|
79
|
-
clavix
|
|
80
|
-
clavix
|
|
82
|
+
/clavix:plan # Generate tasks from PRD
|
|
83
|
+
/clavix:implement # Start implementation workflow
|
|
81
84
|
clavix task-complete <taskId> # Mark tasks done with auto-commit
|
|
82
85
|
```
|
|
83
86
|
|
|
84
87
|
**Supported agents**: Claude Code, Cursor, Windsurf, and [17+ more providers](docs/integrations.md)
|
|
85
88
|
|
|
86
|
-
Learn more: [
|
|
89
|
+
Learn more: [Workflow guide](docs/guides/choosing-workflow.md)
|
|
87
90
|
|
|
88
91
|
### Direct CLI Usage (Alternative)
|
|
89
92
|
|
|
@@ -91,8 +94,8 @@ You can also use Clavix directly from the terminal:
|
|
|
91
94
|
|
|
92
95
|
```bash
|
|
93
96
|
clavix init
|
|
94
|
-
clavix
|
|
95
|
-
clavix
|
|
97
|
+
clavix improve "Create a login page" # Auto-selects depth
|
|
98
|
+
clavix improve --comprehensive "Complex API" # Force comprehensive
|
|
96
99
|
clavix prd
|
|
97
100
|
```
|
|
98
101
|
|
|
@@ -100,7 +103,8 @@ clavix prd
|
|
|
100
103
|
- Overview & navigation: [docs/README.md](docs/README.md)
|
|
101
104
|
- Command reference: [docs/commands/](docs/commands/README.md)
|
|
102
105
|
- Providers: [docs/integrations.md](docs/integrations.md)
|
|
103
|
-
-
|
|
106
|
+
- How it works: [docs/how-it-works.md](docs/how-it-works.md)
|
|
107
|
+
- Philosophy: [docs/philosophy.md](docs/philosophy.md)
|
|
104
108
|
- Guides: [docs/guides/](docs/guides/workflows.md)
|
|
105
109
|
|
|
106
110
|
## Requirements
|
|
@@ -216,25 +216,24 @@ export default class Update extends Command {
|
|
|
216
216
|
This project uses Clavix for prompt improvement and PRD generation.
|
|
217
217
|
|
|
218
218
|
### Available Commands
|
|
219
|
+
- \`clavix improve [prompt]\` - Unified prompt optimization with auto-depth selection
|
|
220
|
+
- \`clavix improve --comprehensive [prompt]\` - Force comprehensive analysis
|
|
221
|
+
- \`clavix improve --standard [prompt]\` - Force standard optimization
|
|
222
|
+
- \`clavix analyze [prompt]\` - JSON analysis output for programmatic use
|
|
219
223
|
- \`clavix prd\` - Generate a comprehensive PRD through guided questions
|
|
220
|
-
- \`clavix fast [prompt]\` - Quick prompt improvements with smart triage
|
|
221
|
-
- \`clavix deep [prompt]\` - Comprehensive prompt analysis
|
|
222
224
|
- \`clavix start\` - Start a conversational session for iterative development
|
|
223
225
|
- \`clavix summarize\` - Extract requirements from conversation history
|
|
224
|
-
- \`clavix
|
|
225
|
-
- \`clavix
|
|
226
|
+
- \`clavix execute [--latest]\` - Execute saved prompts
|
|
227
|
+
- \`clavix verify [--latest]\` - Verify implementation against checklist
|
|
226
228
|
|
|
227
229
|
### Quick Start
|
|
228
230
|
\`\`\`bash
|
|
231
|
+
# Prompt optimization (auto-selects depth)
|
|
232
|
+
clavix improve "Build a user auth system"
|
|
233
|
+
|
|
229
234
|
# Generate a PRD
|
|
230
235
|
clavix prd
|
|
231
236
|
|
|
232
|
-
# Quick prompt improvement
|
|
233
|
-
clavix fast "Build a user auth system"
|
|
234
|
-
|
|
235
|
-
# Deep prompt analysis
|
|
236
|
-
clavix deep "Build a user auth system"
|
|
237
|
-
|
|
238
237
|
# Start conversational mode
|
|
239
238
|
clavix start
|
|
240
239
|
\`\`\`
|
|
@@ -5,11 +5,9 @@ import { StructureOrganizer } from './patterns/structure-organizer.js';
|
|
|
5
5
|
import { CompletenessValidator } from './patterns/completeness-validator.js';
|
|
6
6
|
import { ActionabilityEnhancer } from './patterns/actionability-enhancer.js';
|
|
7
7
|
// v4.0 Comprehensive scope patterns
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import { AssumptionExplicitizer } from './patterns/assumption-explicitizer.js';
|
|
12
|
-
import { ScopeDefiner } from './patterns/scope-definer.js';
|
|
8
|
+
// v4.12: Removed boilerplate patterns (AlternativePhrasingGenerator, EdgeCaseIdentifier,
|
|
9
|
+
// ValidationChecklistCreator, AssumptionExplicitizer, ScopeDefiner, ErrorToleranceEnhancer,
|
|
10
|
+
// PrerequisiteIdentifier) - these generated static output instead of improving prompts
|
|
13
11
|
import { PRDStructureEnforcer } from './patterns/prd-structure-enforcer.js';
|
|
14
12
|
// v4.0 Both scope patterns (standard & comprehensive)
|
|
15
13
|
import { StepDecomposer } from './patterns/step-decomposer.js';
|
|
@@ -18,8 +16,6 @@ import { ContextPrecisionBooster } from './patterns/context-precision.js';
|
|
|
18
16
|
import { AmbiguityDetector } from './patterns/ambiguity-detector.js';
|
|
19
17
|
import { OutputFormatEnforcer } from './patterns/output-format-enforcer.js';
|
|
20
18
|
import { SuccessCriteriaEnforcer } from './patterns/success-criteria-enforcer.js';
|
|
21
|
-
import { ErrorToleranceEnhancer } from './patterns/error-tolerance-enhancer.js';
|
|
22
|
-
import { PrerequisiteIdentifier } from './patterns/prerequisite-identifier.js';
|
|
23
19
|
import { DomainContextEnricher } from './patterns/domain-context-enricher.js';
|
|
24
20
|
// v4.3.2 PRD patterns
|
|
25
21
|
import { RequirementPrioritizer } from './patterns/requirement-prioritizer.js';
|
|
@@ -73,29 +69,24 @@ export class PatternLibrary {
|
|
|
73
69
|
}
|
|
74
70
|
registerDefaultPatterns() {
|
|
75
71
|
// Register core patterns (available in standard & comprehensive scopes)
|
|
76
|
-
|
|
77
|
-
this.register(new
|
|
78
|
-
this.register(new
|
|
79
|
-
this.register(new
|
|
80
|
-
this.register(new
|
|
81
|
-
this.register(new
|
|
72
|
+
// v4.12: 20 patterns total after removing 7 boilerplate patterns
|
|
73
|
+
this.register(new ConcisenessFilter()); // P10 - Remove verbosity
|
|
74
|
+
this.register(new ObjectiveClarifier()); // P9 - Add clarity
|
|
75
|
+
this.register(new TechnicalContextEnricher()); // P8 - Add technical details
|
|
76
|
+
this.register(new StructureOrganizer()); // P8 - Reorder logically
|
|
77
|
+
this.register(new CompletenessValidator()); // P6 - Check missing elements
|
|
78
|
+
this.register(new ActionabilityEnhancer()); // P7 - Vague to specific
|
|
82
79
|
// v4.0 Comprehensive scope patterns
|
|
83
|
-
|
|
84
|
-
this.register(new EdgeCaseIdentifier()); // P4 - Identify edge cases by domain
|
|
85
|
-
this.register(new ValidationChecklistCreator()); // P3 - Create validation checklists
|
|
86
|
-
this.register(new AssumptionExplicitizer()); // P6 - Make implicit assumptions explicit
|
|
87
|
-
this.register(new ScopeDefiner()); // P5 - Add scope boundaries
|
|
80
|
+
// v4.12: Removed boilerplate patterns that generated static output
|
|
88
81
|
this.register(new PRDStructureEnforcer()); // P9 - Ensure PRD completeness
|
|
89
82
|
// v4.0 Both scope patterns (standard & comprehensive)
|
|
90
83
|
this.register(new StepDecomposer()); // P7 - Break complex prompts into steps
|
|
91
84
|
this.register(new ContextPrecisionBooster()); // P8 - Add precise context when missing
|
|
92
85
|
// v4.1 New patterns - Agent transparency & quality improvements
|
|
93
86
|
this.register(new AmbiguityDetector()); // P9 - Identify ambiguous terms (both scopes)
|
|
94
|
-
this.register(new OutputFormatEnforcer()); // P7 - Add output format specs (
|
|
87
|
+
this.register(new OutputFormatEnforcer()); // P7 - Add output format specs (comprehensive only)
|
|
95
88
|
this.register(new SuccessCriteriaEnforcer()); // P6 - Add success criteria (both scopes)
|
|
96
|
-
this.register(new
|
|
97
|
-
this.register(new PrerequisiteIdentifier()); // P6 - Identify prerequisites (comprehensive only)
|
|
98
|
-
this.register(new DomainContextEnricher()); // P5 - Add domain best practices (both scopes)
|
|
89
|
+
this.register(new DomainContextEnricher()); // P5 - Add domain best practices (comprehensive only)
|
|
99
90
|
// v4.3.2 PRD patterns
|
|
100
91
|
this.register(new RequirementPrioritizer()); // P7 - Separate must-have from nice-to-have
|
|
101
92
|
this.register(new UserPersonaEnricher()); // P6 - Add user context and personas
|
|
@@ -30,6 +30,26 @@ export declare class QualityAssessor {
|
|
|
30
30
|
* Penalizes vague language, rewards concrete indicators
|
|
31
31
|
*/
|
|
32
32
|
private assessSpecificity;
|
|
33
|
+
/**
|
|
34
|
+
* Calculate weighted overall quality score
|
|
35
|
+
* v4.12: Added comprehensive weight documentation
|
|
36
|
+
*
|
|
37
|
+
* WEIGHT RATIONALE:
|
|
38
|
+
* Weights are designed based on what matters most for each intent type:
|
|
39
|
+
*
|
|
40
|
+
* | Intent | Primary Focus | Secondary Focus | Rationale |
|
|
41
|
+
* |--------|---------------|-----------------|-----------|
|
|
42
|
+
* | code-generation | completeness (25%) | clarity, actionability (20% each) | Code needs full specs |
|
|
43
|
+
* | planning | structure, completeness (25% each) | clarity (20%) | Plans need organization |
|
|
44
|
+
* | debugging | actionability, completeness (25% each) | specificity (20%) | Need steps to reproduce |
|
|
45
|
+
* | migration | specificity, completeness (25% each) | clarity (20%) | Version/path precision |
|
|
46
|
+
* | testing | completeness (25%) | specificity, actionability (20% each) | Edge cases matter |
|
|
47
|
+
* | security-review | completeness (25%) | specificity, clarity (20% each) | Thorough coverage |
|
|
48
|
+
* | learning | clarity (30%) | structure, completeness (20% each) | Understanding > action |
|
|
49
|
+
* | default | completeness (22%) | clarity, structure, actionability (18% each) | Balanced |
|
|
50
|
+
*
|
|
51
|
+
* These weights can be overridden via ClavixConfig.intelligence.qualityWeights
|
|
52
|
+
*/
|
|
33
53
|
private calculateOverall;
|
|
34
54
|
private identifyStrengths;
|
|
35
55
|
private identifyImprovements;
|
|
@@ -292,8 +292,28 @@ export class QualityAssessor {
|
|
|
292
292
|
}
|
|
293
293
|
return Math.max(0, Math.min(100, score));
|
|
294
294
|
}
|
|
295
|
+
/**
|
|
296
|
+
* Calculate weighted overall quality score
|
|
297
|
+
* v4.12: Added comprehensive weight documentation
|
|
298
|
+
*
|
|
299
|
+
* WEIGHT RATIONALE:
|
|
300
|
+
* Weights are designed based on what matters most for each intent type:
|
|
301
|
+
*
|
|
302
|
+
* | Intent | Primary Focus | Secondary Focus | Rationale |
|
|
303
|
+
* |--------|---------------|-----------------|-----------|
|
|
304
|
+
* | code-generation | completeness (25%) | clarity, actionability (20% each) | Code needs full specs |
|
|
305
|
+
* | planning | structure, completeness (25% each) | clarity (20%) | Plans need organization |
|
|
306
|
+
* | debugging | actionability, completeness (25% each) | specificity (20%) | Need steps to reproduce |
|
|
307
|
+
* | migration | specificity, completeness (25% each) | clarity (20%) | Version/path precision |
|
|
308
|
+
* | testing | completeness (25%) | specificity, actionability (20% each) | Edge cases matter |
|
|
309
|
+
* | security-review | completeness (25%) | specificity, clarity (20% each) | Thorough coverage |
|
|
310
|
+
* | learning | clarity (30%) | structure, completeness (20% each) | Understanding > action |
|
|
311
|
+
* | default | completeness (22%) | clarity, structure, actionability (18% each) | Balanced |
|
|
312
|
+
*
|
|
313
|
+
* These weights can be overridden via ClavixConfig.intelligence.qualityWeights
|
|
314
|
+
*/
|
|
295
315
|
calculateOverall(scores, intent) {
|
|
296
|
-
// v4.0: Intent-specific weights
|
|
316
|
+
// v4.0: Intent-specific weights (see rationale in method comment above)
|
|
297
317
|
if (intent.primaryIntent === 'code-generation') {
|
|
298
318
|
// Code generation benefits most from specificity
|
|
299
319
|
return (scores.clarity * 0.2 +
|
|
@@ -2,6 +2,7 @@ import { IntentDetector } from './intent-detector.js';
|
|
|
2
2
|
import { PatternLibrary } from './pattern-library.js';
|
|
3
3
|
import { QualityAssessor } from './quality-assessor.js';
|
|
4
4
|
import { OptimizationResult, OptimizationMode, OptimizationPhase, DocumentType, EscalationAnalysis, DepthLevel } from './types.js';
|
|
5
|
+
import { EscalationThresholdsConfig } from '../../types/config.js';
|
|
5
6
|
/**
|
|
6
7
|
* v4.11: Extended context options for optimization modes
|
|
7
8
|
*/
|
|
@@ -16,7 +17,12 @@ export declare class UniversalOptimizer {
|
|
|
16
17
|
private intentDetector;
|
|
17
18
|
private patternLibrary;
|
|
18
19
|
private qualityAssessor;
|
|
19
|
-
|
|
20
|
+
private thresholds;
|
|
21
|
+
constructor(intentDetector?: IntentDetector, patternLibrary?: PatternLibrary, qualityAssessor?: QualityAssessor, escalationConfig?: EscalationThresholdsConfig);
|
|
22
|
+
/**
|
|
23
|
+
* v4.12: Get current threshold configuration
|
|
24
|
+
*/
|
|
25
|
+
getThresholds(): Required<EscalationThresholdsConfig>;
|
|
20
26
|
/**
|
|
21
27
|
* v4.11: Optimize a prompt using Clavix Intelligence
|
|
22
28
|
* @param prompt The prompt to optimize
|
|
@@ -49,6 +55,7 @@ export declare class UniversalOptimizer {
|
|
|
49
55
|
/**
|
|
50
56
|
* v4.11: Analyze whether to escalate from standard to comprehensive depth
|
|
51
57
|
* Uses multi-factor scoring for intelligent triage decisions
|
|
58
|
+
* v4.12: Uses configurable thresholds from EscalationThresholdsConfig
|
|
52
59
|
*
|
|
53
60
|
* IMPORTANT: Quality checks use the ORIGINAL prompt, not the enhanced one,
|
|
54
61
|
* because triage decisions should be based on what the user wrote.
|
|
@@ -1,14 +1,34 @@
|
|
|
1
1
|
import { IntentDetector } from './intent-detector.js';
|
|
2
2
|
import { PatternLibrary } from './pattern-library.js';
|
|
3
3
|
import { QualityAssessor } from './quality-assessor.js';
|
|
4
|
+
/**
|
|
5
|
+
* v4.12: Default escalation thresholds
|
|
6
|
+
* These can be overridden via ClavixConfig.intelligence.escalation
|
|
7
|
+
*/
|
|
8
|
+
const DEFAULT_THRESHOLDS = {
|
|
9
|
+
comprehensiveAbove: 75,
|
|
10
|
+
standardFloor: 60,
|
|
11
|
+
intentConfidenceMin: 50,
|
|
12
|
+
strongRecommendAbove: 75,
|
|
13
|
+
suggestAbove: 45,
|
|
14
|
+
};
|
|
4
15
|
export class UniversalOptimizer {
|
|
5
16
|
intentDetector;
|
|
6
17
|
patternLibrary;
|
|
7
18
|
qualityAssessor;
|
|
8
|
-
|
|
19
|
+
thresholds;
|
|
20
|
+
constructor(intentDetector, patternLibrary, qualityAssessor, escalationConfig) {
|
|
9
21
|
this.intentDetector = intentDetector || new IntentDetector();
|
|
10
22
|
this.patternLibrary = patternLibrary || new PatternLibrary();
|
|
11
23
|
this.qualityAssessor = qualityAssessor || new QualityAssessor();
|
|
24
|
+
// v4.12: Merge user config with defaults
|
|
25
|
+
this.thresholds = { ...DEFAULT_THRESHOLDS, ...escalationConfig };
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* v4.12: Get current threshold configuration
|
|
29
|
+
*/
|
|
30
|
+
getThresholds() {
|
|
31
|
+
return { ...this.thresholds };
|
|
12
32
|
}
|
|
13
33
|
/**
|
|
14
34
|
* v4.11: Optimize a prompt using Clavix Intelligence
|
|
@@ -143,6 +163,7 @@ export class UniversalOptimizer {
|
|
|
143
163
|
/**
|
|
144
164
|
* v4.11: Analyze whether to escalate from standard to comprehensive depth
|
|
145
165
|
* Uses multi-factor scoring for intelligent triage decisions
|
|
166
|
+
* v4.12: Uses configurable thresholds from EscalationThresholdsConfig
|
|
146
167
|
*
|
|
147
168
|
* IMPORTANT: Quality checks use the ORIGINAL prompt, not the enhanced one,
|
|
148
169
|
* because triage decisions should be based on what the user wrote.
|
|
@@ -150,6 +171,8 @@ export class UniversalOptimizer {
|
|
|
150
171
|
analyzeEscalation(result) {
|
|
151
172
|
const reasons = [];
|
|
152
173
|
let totalScore = 0;
|
|
174
|
+
// v4.12: Use configurable thresholds
|
|
175
|
+
const { standardFloor, suggestAbove, strongRecommendAbove, intentConfidenceMin } = this.thresholds;
|
|
153
176
|
// Assess the ORIGINAL prompt's quality for triage decisions
|
|
154
177
|
// (result.quality is for the enhanced prompt)
|
|
155
178
|
const originalQuality = this.qualityAssessor.assessQuality(result.original, result.intent.primaryIntent);
|
|
@@ -164,9 +187,10 @@ export class UniversalOptimizer {
|
|
|
164
187
|
description: `${result.intent.primaryIntent} tasks benefit from comprehensive analysis`,
|
|
165
188
|
});
|
|
166
189
|
}
|
|
167
|
-
// Factor 2: Low confidence (<
|
|
168
|
-
|
|
169
|
-
|
|
190
|
+
// Factor 2: Low confidence (< intentConfidenceMin+10 → up to +20 pts)
|
|
191
|
+
const confidenceThreshold = intentConfidenceMin + 10; // Default: 60
|
|
192
|
+
if (result.intent.confidence < confidenceThreshold) {
|
|
193
|
+
const contribution = Math.round((confidenceThreshold - result.intent.confidence) / 3); // Max 20 pts
|
|
170
194
|
totalScore += contribution;
|
|
171
195
|
reasons.push({
|
|
172
196
|
factor: 'low-confidence',
|
|
@@ -174,9 +198,10 @@ export class UniversalOptimizer {
|
|
|
174
198
|
description: `Intent detection confidence is low (${result.intent.confidence}%)`,
|
|
175
199
|
});
|
|
176
200
|
}
|
|
177
|
-
// Factor 3: Overall quality score (<
|
|
178
|
-
|
|
179
|
-
|
|
201
|
+
// Factor 3: Overall quality score (< standardFloor+5 → up to +25 pts) - uses ORIGINAL quality
|
|
202
|
+
const qualityThreshold = standardFloor + 5; // Default: 65
|
|
203
|
+
if (originalQuality.overall < qualityThreshold) {
|
|
204
|
+
const contribution = Math.round((qualityThreshold - originalQuality.overall) / 2.6); // Max ~25 pts
|
|
180
205
|
totalScore += contribution;
|
|
181
206
|
reasons.push({
|
|
182
207
|
factor: 'low-quality',
|
|
@@ -184,8 +209,8 @@ export class UniversalOptimizer {
|
|
|
184
209
|
description: `Original prompt quality is below threshold (${Math.round(originalQuality.overall)}/100)`,
|
|
185
210
|
});
|
|
186
211
|
}
|
|
187
|
-
// Factor 4: Low completeness (<
|
|
188
|
-
if (originalQuality.completeness <
|
|
212
|
+
// Factor 4: Low completeness (< standardFloor → +15 pts) - uses ORIGINAL quality
|
|
213
|
+
if (originalQuality.completeness < standardFloor) {
|
|
189
214
|
const contribution = 15;
|
|
190
215
|
totalScore += contribution;
|
|
191
216
|
reasons.push({
|
|
@@ -194,8 +219,8 @@ export class UniversalOptimizer {
|
|
|
194
219
|
description: `Missing required details (completeness: ${Math.round(originalQuality.completeness)}%)`,
|
|
195
220
|
});
|
|
196
221
|
}
|
|
197
|
-
// Factor 5: Low specificity (<
|
|
198
|
-
if (originalQuality.specificity <
|
|
222
|
+
// Factor 5: Low specificity (< standardFloor → +15 pts) - uses ORIGINAL quality
|
|
223
|
+
if (originalQuality.specificity < standardFloor) {
|
|
199
224
|
const contribution = 15;
|
|
200
225
|
totalScore += contribution;
|
|
201
226
|
reasons.push({
|
|
@@ -215,7 +240,9 @@ export class UniversalOptimizer {
|
|
|
215
240
|
});
|
|
216
241
|
}
|
|
217
242
|
// Factor 7: Length mismatch (short prompt + incomplete → +15 pts) - uses ORIGINAL quality
|
|
218
|
-
|
|
243
|
+
const completenessLenientThreshold = standardFloor + 10; // Default: 70
|
|
244
|
+
if (result.original.length < 50 &&
|
|
245
|
+
originalQuality.completeness < completenessLenientThreshold) {
|
|
219
246
|
const contribution = 15;
|
|
220
247
|
totalScore += contribution;
|
|
221
248
|
reasons.push({
|
|
@@ -235,13 +262,14 @@ export class UniversalOptimizer {
|
|
|
235
262
|
description: `${result.intent.primaryIntent} requires thorough analysis`,
|
|
236
263
|
});
|
|
237
264
|
}
|
|
238
|
-
// Determine escalation confidence
|
|
239
|
-
//
|
|
265
|
+
// v4.12: Determine escalation confidence using configurable thresholds
|
|
266
|
+
// suggestAbove for escalation, (suggestAbove+strongRecommendAbove)/2 for medium, strongRecommendAbove for high
|
|
267
|
+
const mediumThreshold = Math.round((suggestAbove + strongRecommendAbove) / 2); // Default: 60
|
|
240
268
|
let escalationConfidence;
|
|
241
|
-
if (totalScore >=
|
|
269
|
+
if (totalScore >= strongRecommendAbove) {
|
|
242
270
|
escalationConfidence = 'high';
|
|
243
271
|
}
|
|
244
|
-
else if (totalScore >=
|
|
272
|
+
else if (totalScore >= mediumThreshold) {
|
|
245
273
|
escalationConfidence = 'medium';
|
|
246
274
|
}
|
|
247
275
|
else {
|
|
@@ -250,8 +278,8 @@ export class UniversalOptimizer {
|
|
|
250
278
|
// v4.11: Generate comprehensive mode value proposition
|
|
251
279
|
const comprehensiveValue = this.generateComprehensiveValue(result, reasons);
|
|
252
280
|
return {
|
|
253
|
-
//
|
|
254
|
-
shouldEscalate: totalScore >=
|
|
281
|
+
// v4.12: Use configurable suggestAbove threshold (default: 45)
|
|
282
|
+
shouldEscalate: totalScore >= suggestAbove,
|
|
255
283
|
escalationScore: Math.min(totalScore, 100),
|
|
256
284
|
escalationConfidence,
|
|
257
285
|
reasons,
|
|
@@ -9,7 +9,7 @@ This guide is for agents that can only read documentation (no slash-command supp
|
|
|
9
9
|
**CRITICAL: Know which mode you're in and STOP at the right point.**
|
|
10
10
|
|
|
11
11
|
**OPTIMIZATION workflows** (NO CODE ALLOWED):
|
|
12
|
-
-
|
|
12
|
+
- Improve mode - Prompt optimization only (auto-selects depth)
|
|
13
13
|
- Your role: Analyze, optimize, show improved prompt, **STOP**
|
|
14
14
|
- ❌ DO NOT implement the prompt's requirements
|
|
15
15
|
- ✅ After showing optimized prompt, tell user: "Run `/clavix:execute --latest` to implement"
|
|
@@ -38,11 +38,11 @@ For complete step-by-step workflows, see `.clavix/instructions/`:
|
|
|
38
38
|
|----------|-----------------|---------|
|
|
39
39
|
| **Conversational Mode** | `workflows/start.md` | Natural requirements gathering through discussion |
|
|
40
40
|
| **Extract Requirements** | `workflows/summarize.md` | Analyze conversation → mini-PRD + optimized prompts |
|
|
41
|
-
| **
|
|
42
|
-
| **Deep Analysis** | `workflows/deep.md` | Comprehensive with alternatives, validation, edge cases |
|
|
41
|
+
| **Prompt Optimization** | `workflows/improve.md` | Intent detection + quality assessment + auto-depth selection |
|
|
43
42
|
| **PRD Generation** | `workflows/prd.md` | Socratic questions → full PRD + quick PRD |
|
|
44
43
|
| **Mode Boundaries** | `core/clavix-mode.md` | Planning vs implementation distinction |
|
|
45
44
|
| **File Operations** | `core/file-operations.md` | File creation patterns |
|
|
45
|
+
| **Verification** | `core/verification.md` | Post-implementation verification |
|
|
46
46
|
|
|
47
47
|
**Troubleshooting:**
|
|
48
48
|
- `troubleshooting/jumped-to-implementation.md` - If you started coding during planning
|
|
@@ -55,11 +55,12 @@ For complete step-by-step workflows, see `.clavix/instructions/`:
|
|
|
55
55
|
|
|
56
56
|
| Keywords in User Request | Recommended Workflow | File Reference |
|
|
57
57
|
|---------------------------|---------------------|----------------|
|
|
58
|
-
| "improve this prompt", "make it better", "optimize" |
|
|
59
|
-
| "analyze thoroughly", "edge cases", "alternatives" |
|
|
58
|
+
| "improve this prompt", "make it better", "optimize" | Improve mode → Auto-depth optimization | `workflows/improve.md` |
|
|
59
|
+
| "analyze thoroughly", "edge cases", "alternatives" | Improve mode (--comprehensive) | `workflows/improve.md` |
|
|
60
60
|
| "create a PRD", "product requirements" | PRD mode → Socratic questioning | `workflows/prd.md` |
|
|
61
61
|
| "let's discuss", "not sure what I want" | Conversational mode → Start gathering | `workflows/start.md` |
|
|
62
62
|
| "summarize our conversation" | Extract mode → Analyze thread | `workflows/summarize.md` |
|
|
63
|
+
| "verify", "check my implementation" | Verify mode → Implementation verification | `core/verification.md` |
|
|
63
64
|
|
|
64
65
|
**When detected:** Reference the corresponding `.clavix/instructions/workflows/{workflow}.md` file.
|
|
65
66
|
|
|
@@ -70,11 +71,14 @@ For complete step-by-step workflows, see `.clavix/instructions/`:
|
|
|
70
71
|
| Command | Purpose |
|
|
71
72
|
|---------|---------|
|
|
72
73
|
| `clavix init` | Interactive setup with integration selection |
|
|
73
|
-
| `clavix
|
|
74
|
-
| `clavix
|
|
74
|
+
| `clavix improve "<prompt>"` | Unified optimization with auto-depth selection |
|
|
75
|
+
| `clavix improve --comprehensive "<prompt>"` | Force comprehensive analysis |
|
|
76
|
+
| `clavix improve --standard "<prompt>"` | Force standard optimization |
|
|
77
|
+
| `clavix analyze "<prompt>"` | JSON analysis output for programmatic use |
|
|
75
78
|
| `clavix execute [--latest]` | Execute saved prompts (interactive or --latest) |
|
|
79
|
+
| `clavix verify [--latest]` | Verify implementation against checklist |
|
|
76
80
|
| `clavix prompts list` | View saved prompts with status (NEW, EXECUTED, OLD, STALE) |
|
|
77
|
-
| `clavix prompts clear` | Manage cleanup (--executed, --stale, --
|
|
81
|
+
| `clavix prompts clear` | Manage cleanup (--executed, --stale, --standard, --comprehensive, --all) |
|
|
78
82
|
| `clavix prd` | Guided PRD generation → `full-prd.md` + `quick-prd.md` |
|
|
79
83
|
| `clavix plan` | Transform PRD → phase-based `tasks.md` |
|
|
80
84
|
| `clavix implement [--commit-strategy=<type>]` | Execute tasks (git strategies: per-task, per-5-tasks, per-phase, none) |
|
|
@@ -91,6 +95,8 @@ clavix init
|
|
|
91
95
|
clavix version
|
|
92
96
|
```
|
|
93
97
|
|
|
98
|
+
**Save behavior:** CLI auto-saves prompts to `.clavix/outputs/`. When using slash commands, the agent must save manually per template instructions (no automatic persistence).
|
|
99
|
+
|
|
94
100
|
---
|
|
95
101
|
|
|
96
102
|
## 🔄 Standard Workflow
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Clavix Instructions for GitHub Copilot
|
|
2
2
|
|
|
3
|
-
These instructions enhance GitHub Copilot's understanding of Clavix
|
|
3
|
+
These instructions enhance GitHub Copilot's understanding of Clavix prompt optimization workflows available in this project.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -57,7 +57,7 @@ Checkpoints are standardized markers that agents output to confirm workflow step
|
|
|
57
57
|
|
|
58
58
|
**After multi-step processes:**
|
|
59
59
|
```markdown
|
|
60
|
-
**CHECKPOINT:** Completed
|
|
60
|
+
**CHECKPOINT:** Completed pattern-based optimization - 5 improvements applied
|
|
61
61
|
**CHECKPOINT:** Analyzed conversation - extracted 12 requirements, 3 constraints
|
|
62
62
|
```
|
|
63
63
|
|
|
@@ -273,7 +273,7 @@ If workflow isn't proceeding as expected, check:
|
|
|
273
273
|
**CHECKPOINT:** All files verified - exist at expected paths
|
|
274
274
|
|
|
275
275
|
6. After optimization:
|
|
276
|
-
**CHECKPOINT:** Applied
|
|
276
|
+
**CHECKPOINT:** Applied optimization patterns - [N] improvements added
|
|
277
277
|
|
|
278
278
|
7. Workflow complete:
|
|
279
279
|
**CHECKPOINT:** Summarization workflow complete - all outputs created
|
|
@@ -65,7 +65,7 @@ Tell them: **"Run `/clavix:execute --latest` to implement this prompt."**
|
|
|
65
65
|
```
|
|
66
66
|
**CLAVIX MODE: Improve**
|
|
67
67
|
Mode: planning
|
|
68
|
-
Purpose: Optimizing user prompt with
|
|
68
|
+
Purpose: Optimizing user prompt with pattern-based analysis
|
|
69
69
|
Depth: [standard|comprehensive] (auto-detected based on quality score)
|
|
70
70
|
Implementation: BLOCKED - I will analyze and improve the prompt, not implement it
|
|
71
71
|
```
|
|
@@ -164,7 +164,7 @@ Implementation: BLOCKED - I will ask questions and explore needs, not implement
|
|
|
164
164
|
|
|
165
165
|
After the conversational session, `/clavix:summarize` will:
|
|
166
166
|
- Extract requirements from the conversation
|
|
167
|
-
- Apply
|
|
167
|
+
- Apply pattern-based optimization
|
|
168
168
|
- Analyze intent and assess quality (Clarity, Efficiency, Structure, Completeness, Actionability)
|
|
169
169
|
- Generate both original extraction and optimized version
|
|
170
170
|
- Display quality scores and improvements
|
|
@@ -54,7 +54,7 @@ For complete mode documentation, see: `.clavix/instructions/core/clavix-mode.md`
|
|
|
54
54
|
| 2. Skipping Pre-Validation | Not checking conversation completeness before extracting requirements |
|
|
55
55
|
| 3. Missing Confidence Indicators | Not annotating requirements with [HIGH], [MEDIUM], [LOW] confidence |
|
|
56
56
|
| 4. Not Creating Output Files | Not creating mini-prd.md, optimized-prompt.md, and quick-prd.md files |
|
|
57
|
-
| 5. No
|
|
57
|
+
| 5. No Optimization Applied | Not applying quality patterns to extracted requirements |
|
|
58
58
|
| 6. Capability Hallucination | Claiming features Clavix doesn't have, inventing workflows |
|
|
59
59
|
|
|
60
60
|
**STOP**: Immediately halt the incorrect action
|
|
@@ -229,7 +229,7 @@ Implementation: BLOCKED - I will extract requirements, not implement them
|
|
|
229
229
|
|
|
230
230
|
Use the Write tool to create `.clavix/outputs/[project-name]/optimized-prompt.md`
|
|
231
231
|
|
|
232
|
-
**Content:** Enhanced version with
|
|
232
|
+
**Content:** Enhanced version with pattern-based optimization (see step 4 below for optimization)
|
|
233
233
|
|
|
234
234
|
**Format:**
|
|
235
235
|
```markdown
|
|
@@ -243,7 +243,7 @@ Implementation: BLOCKED - I will extract requirements, not implement them
|
|
|
243
243
|
|
|
244
244
|
---
|
|
245
245
|
|
|
246
|
-
##
|
|
246
|
+
## Optimization Improvements Applied
|
|
247
247
|
|
|
248
248
|
1. **[ADDED]** - [Description of what was added and why]
|
|
249
249
|
2. **[CLARIFIED]** - [What was ambiguous and how it was clarified]
|
|
@@ -273,8 +273,8 @@ Implementation: BLOCKED - I will extract requirements, not implement them
|
|
|
273
273
|
- Something went wrong with file creation
|
|
274
274
|
- Retry the Write tool for the missing file
|
|
275
275
|
|
|
276
|
-
4. **
|
|
277
|
-
- After extracting the prompt, analyze using
|
|
276
|
+
4. **Pattern-Based Optimization** (automatic with labeled improvements):
|
|
277
|
+
- After extracting the prompt, analyze using pattern-based optimization
|
|
278
278
|
- Apply optimizations for Clarity, Efficiency, Structure, Completeness, and Actionability
|
|
279
279
|
- **Label all improvements** with quality dimension tags:
|
|
280
280
|
- **[Efficiency]**: "Removed 12 conversational words, reduced from 45 to 28 words"
|
|
@@ -286,7 +286,7 @@ Implementation: BLOCKED - I will extract requirements, not implement them
|
|
|
286
286
|
- Show quality scores (before/after) and labeled improvements
|
|
287
287
|
- These improvements were already applied when creating optimized-prompt.md in step 3.4
|
|
288
288
|
|
|
289
|
-
**CHECKPOINT:** Applied
|
|
289
|
+
**CHECKPOINT:** Applied pattern-based optimization - [N] improvements added
|
|
290
290
|
|
|
291
291
|
5. **Highlight Key Insights** discovered during the conversation:
|
|
292
292
|
```markdown
|
|
@@ -324,8 +324,8 @@ Implementation: BLOCKED - I will extract requirements, not implement them
|
|
|
324
324
|
|
|
325
325
|
**📁 Location:** `.clavix/outputs/[project-name]/`
|
|
326
326
|
|
|
327
|
-
**🎯
|
|
328
|
-
Applied [N]
|
|
327
|
+
**🎯 Optimizations Applied:**
|
|
328
|
+
Applied [N] improvements:
|
|
329
329
|
- [Brief summary of improvements]
|
|
330
330
|
|
|
331
331
|
**🔍 Key Insights:**
|
|
@@ -38,7 +38,7 @@ Implementation: [BLOCKED|ALLOWED]
|
|
|
38
38
|
```
|
|
39
39
|
**CLAVIX MODE: Improve**
|
|
40
40
|
Mode: planning
|
|
41
|
-
Purpose: Optimizing user prompt with
|
|
41
|
+
Purpose: Optimizing user prompt with pattern-based analysis
|
|
42
42
|
Implementation: BLOCKED - I will analyze and improve the prompt, not implement it
|
|
43
43
|
```
|
|
44
44
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## Intent Types Reference
|
|
2
2
|
|
|
3
|
-
Clavix
|
|
3
|
+
Clavix detects 11 primary intent types using pattern-based analysis. This reference is synchronized with `src/core/intelligence/types.ts`.
|
|
4
4
|
|
|
5
5
|
### Intent Categories
|
|
6
6
|
|
|
@@ -29,8 +29,8 @@ Patterns: 7 applied (comprehensive depth)
|
|
|
29
29
|
StructureOrganizer → Reorganized into 4 sections
|
|
30
30
|
TechnicalContextEnricher → Added React 18, TypeScript context
|
|
31
31
|
CompletenessValidator → Flagged 3 missing requirements
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
DomainContextEnricher → Added best practices for React components
|
|
33
|
+
SuccessCriteriaEnforcer → Added measurable acceptance criteria
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
### Pattern Impact Indicators
|
|
@@ -43,43 +43,32 @@ Patterns: 7 applied (comprehensive depth)
|
|
|
43
43
|
|
|
44
44
|
### Available Patterns Reference
|
|
45
45
|
|
|
46
|
-
**
|
|
46
|
+
**v4.12: Core Patterns (standard + comprehensive, scope='both'):**
|
|
47
47
|
| Pattern | Priority | What It Does |
|
|
48
48
|
|---------|----------|--------------|
|
|
49
|
-
| ConcisenessFilter | 4 | Removes pleasantries, filler words, redundant phrases |
|
|
50
49
|
| ObjectiveClarifier | 9 | Adds clear objective/goal statement if missing |
|
|
51
|
-
| StructureOrganizer | 8 | Reorders into logical flow: context→requirements→constraints→output |
|
|
52
|
-
| ActionabilityEnhancer | 4 | Converts vague language to specific, actionable terms |
|
|
53
|
-
| TechnicalContextEnricher | 5 | Adds missing technical context (frameworks, tools, versions) |
|
|
54
|
-
| CompletenessValidator | 6 | Identifies and flags missing required elements |
|
|
55
|
-
| StepDecomposer | 5 | Breaks complex prompts into sequential steps |
|
|
56
|
-
| ContextPrecisionBooster | 6 | Adds precise context when missing |
|
|
57
50
|
| AmbiguityDetector | 9 | Identifies and flags ambiguous terms |
|
|
51
|
+
| StructureOrganizer | 8 | Reorders into logical flow: context→requirements→constraints→output |
|
|
58
52
|
| OutputFormatEnforcer | 7 | Adds explicit output format specifications |
|
|
59
53
|
| SuccessCriteriaEnforcer | 7 | Adds measurable success criteria |
|
|
54
|
+
| ContextPrecisionBooster | 6 | Adds precise context when missing |
|
|
55
|
+
| CompletenessValidator | 6 | Identifies and flags missing required elements |
|
|
56
|
+
| TechnicalContextEnricher | 5 | Adds missing technical context (frameworks, tools, versions) |
|
|
57
|
+
| StepDecomposer | 5 | Breaks complex prompts into sequential steps |
|
|
60
58
|
| DomainContextEnricher | 5 | Adds domain-specific best practices |
|
|
59
|
+
| ConcisenessFilter | 4 | Removes pleasantries, filler words, redundant phrases |
|
|
60
|
+
| ActionabilityEnhancer | 4 | Converts vague language to specific, actionable terms |
|
|
61
61
|
|
|
62
|
-
**
|
|
62
|
+
**v4.12 PRD Mode Patterns (comprehensive only):**
|
|
63
63
|
| Pattern | Priority | What It Does |
|
|
64
64
|
|---------|----------|--------------|
|
|
65
|
-
| AlternativePhrasingGenerator | 3 | Generates 2-3 alternative prompt structures |
|
|
66
|
-
| EdgeCaseIdentifier | 4 | Identifies domain-specific edge cases |
|
|
67
|
-
| ValidationChecklistCreator | 3 | Creates implementation verification checklist |
|
|
68
|
-
| AssumptionExplicitizer | 6 | Makes implicit assumptions explicit |
|
|
69
|
-
| ScopeDefiner | 5 | Adds explicit scope boundaries |
|
|
70
65
|
| PRDStructureEnforcer | 9 | Ensures PRD completeness (PRD mode only) |
|
|
71
|
-
| ErrorToleranceEnhancer | 5 | Adds error handling requirements |
|
|
72
|
-
| PrerequisiteIdentifier | 6 | Identifies prerequisites and dependencies |
|
|
73
|
-
|
|
74
|
-
**v4.3.2 PRD Mode Patterns (comprehensive):**
|
|
75
|
-
| Pattern | Priority | What It Does |
|
|
76
|
-
|---------|----------|--------------|
|
|
77
66
|
| RequirementPrioritizer | 7 | Separates must-have from nice-to-have requirements |
|
|
78
|
-
| UserPersonaEnricher | 6 | Adds missing user context and personas |
|
|
79
67
|
| SuccessMetricsEnforcer | 7 | Ensures measurable success criteria exist |
|
|
68
|
+
| UserPersonaEnricher | 6 | Adds missing user context and personas |
|
|
80
69
|
| DependencyIdentifier | 5 | Identifies technical and external dependencies |
|
|
81
70
|
|
|
82
|
-
**v4.
|
|
71
|
+
**v4.12 Conversational Mode Patterns (comprehensive only):**
|
|
83
72
|
| Pattern | Priority | What It Does |
|
|
84
73
|
|---------|----------|--------------|
|
|
85
74
|
| ConversationSummarizer | 8 | Extracts structured requirements from messages |
|
|
@@ -107,23 +96,17 @@ Skipped patterns:
|
|
|
107
96
|
### Pattern Categories Summary
|
|
108
97
|
|
|
109
98
|
```
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
v4.3.2 PRD mode (comprehensive):
|
|
123
|
-
RequirementPrioritizer, UserPersonaEnricher, SuccessMetricsEnforcer,
|
|
124
|
-
DependencyIdentifier
|
|
125
|
-
|
|
126
|
-
v4.3.2 Conversational mode (comprehensive):
|
|
99
|
+
v4.12: Core patterns (standard + comprehensive, 12 patterns):
|
|
100
|
+
ObjectiveClarifier, AmbiguityDetector, StructureOrganizer,
|
|
101
|
+
OutputFormatEnforcer, SuccessCriteriaEnforcer, ContextPrecisionBooster,
|
|
102
|
+
CompletenessValidator, TechnicalContextEnricher, StepDecomposer,
|
|
103
|
+
DomainContextEnricher, ConcisenessFilter, ActionabilityEnhancer
|
|
104
|
+
|
|
105
|
+
PRD mode (comprehensive only, 5 patterns):
|
|
106
|
+
PRDStructureEnforcer, RequirementPrioritizer, SuccessMetricsEnforcer,
|
|
107
|
+
UserPersonaEnricher, DependencyIdentifier
|
|
108
|
+
|
|
109
|
+
Conversational mode (comprehensive only, 3 patterns):
|
|
127
110
|
ConversationSummarizer, TopicCoherenceAnalyzer, ImplicitRequirementExtractor
|
|
128
111
|
```
|
|
129
112
|
|
|
@@ -131,9 +114,9 @@ v4.3.2 Conversational mode (comprehensive):
|
|
|
131
114
|
|
|
132
115
|
| Depth | Patterns Available | Typical Applied |
|
|
133
116
|
|------|-------------------|-----------------|
|
|
134
|
-
| Standard | 12 patterns | 4-
|
|
135
|
-
| Comprehensive |
|
|
136
|
-
| PRD mode |
|
|
137
|
-
| Conversational |
|
|
117
|
+
| Standard | 12 patterns | 4-8 patterns |
|
|
118
|
+
| Comprehensive | 20 patterns | 8-15 patterns |
|
|
119
|
+
| PRD mode | 17 patterns | 8-12 patterns |
|
|
120
|
+
| Conversational | 15 patterns | 6-10 patterns |
|
|
138
121
|
|
|
139
|
-
**Note:**
|
|
122
|
+
**Note:** v4.12 has 20 total patterns after removing 7 boilerplate patterns that generated static output. Pattern selection varies by intent - some patterns only apply to specific intents (e.g., PRDStructureEnforcer only for prd-generation). Standard depth gets 12 core patterns; comprehensive adds mode-specific patterns.
|
package/dist/types/config.d.ts
CHANGED
|
@@ -14,12 +14,69 @@ export interface ClavixConfig {
|
|
|
14
14
|
* v4.4 Intelligence Configuration
|
|
15
15
|
* Configure pattern behavior, enable/disable patterns, adjust priorities
|
|
16
16
|
* v4.11: Removed defaultMode (fast/deep replaced by improve with auto-detection)
|
|
17
|
+
* v4.12: Added escalation thresholds configuration
|
|
17
18
|
*/
|
|
18
19
|
export interface IntelligenceConfig {
|
|
19
20
|
/** Pattern-specific settings */
|
|
20
21
|
patterns?: PatternSettingsConfig;
|
|
21
22
|
/** Enable verbose pattern logging */
|
|
22
23
|
verbosePatternLogs?: boolean;
|
|
24
|
+
/** v4.12: Escalation threshold configuration */
|
|
25
|
+
escalation?: EscalationThresholdsConfig;
|
|
26
|
+
/** v4.12: Quality assessment weight overrides */
|
|
27
|
+
qualityWeights?: QualityWeightsConfig;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* v4.12: Configurable escalation thresholds
|
|
31
|
+
* These control when comprehensive analysis is recommended vs standard
|
|
32
|
+
*/
|
|
33
|
+
export interface EscalationThresholdsConfig {
|
|
34
|
+
/**
|
|
35
|
+
* Quality score threshold for comprehensive mode (default: 75)
|
|
36
|
+
* Prompts >= this score get comprehensive analysis
|
|
37
|
+
*/
|
|
38
|
+
comprehensiveAbove?: number;
|
|
39
|
+
/**
|
|
40
|
+
* Quality score threshold for standard mode floor (default: 60)
|
|
41
|
+
* Prompts between standardFloor and comprehensiveAbove get standard optimization
|
|
42
|
+
*/
|
|
43
|
+
standardFloor?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Intent confidence threshold for auto-proceed (default: 50)
|
|
46
|
+
* Below this, ask user to confirm intent
|
|
47
|
+
*/
|
|
48
|
+
intentConfidenceMin?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Escalation score threshold for strong recommendation (default: 75)
|
|
51
|
+
* Above this, strongly recommend comprehensive mode
|
|
52
|
+
*/
|
|
53
|
+
strongRecommendAbove?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Escalation score threshold for suggestion (default: 45)
|
|
56
|
+
* Above this, suggest comprehensive mode as option
|
|
57
|
+
*/
|
|
58
|
+
suggestAbove?: number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* v4.12: Quality dimension weight overrides by intent
|
|
62
|
+
* Allows customizing how quality scores are weighted per intent type
|
|
63
|
+
*/
|
|
64
|
+
export interface QualityWeightsConfig {
|
|
65
|
+
/** Override weights for specific intents */
|
|
66
|
+
byIntent?: Record<string, QualityDimensionWeights>;
|
|
67
|
+
/** Default weights for all intents (overrides built-in defaults) */
|
|
68
|
+
defaults?: QualityDimensionWeights;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Weight distribution across quality dimensions (must sum to 100)
|
|
72
|
+
*/
|
|
73
|
+
export interface QualityDimensionWeights {
|
|
74
|
+
clarity?: number;
|
|
75
|
+
efficiency?: number;
|
|
76
|
+
structure?: number;
|
|
77
|
+
completeness?: number;
|
|
78
|
+
actionability?: number;
|
|
79
|
+
specificity?: number;
|
|
23
80
|
}
|
|
24
81
|
/**
|
|
25
82
|
* Pattern-specific settings
|
|
@@ -1,9 +1,34 @@
|
|
|
1
1
|
import * as path from 'path';
|
|
2
2
|
import { FileSystem } from './file-system.js';
|
|
3
|
+
/**
|
|
4
|
+
* v4.12: Deprecated commands that have been replaced
|
|
5
|
+
* - fast → improve (unified with auto-depth)
|
|
6
|
+
* - deep → improve --comprehensive
|
|
7
|
+
*/
|
|
8
|
+
const DEPRECATED_COMMANDS = ['fast', 'deep'];
|
|
3
9
|
export async function collectLegacyCommandFiles(adapter, commandNames) {
|
|
4
10
|
const legacyPaths = new Set();
|
|
5
11
|
const extension = adapter.fileExtension;
|
|
6
12
|
const commandDir = path.resolve(adapter.getCommandPath());
|
|
13
|
+
// v4.12: Clean up deprecated fast/deep commands
|
|
14
|
+
for (const deprecatedName of DEPRECATED_COMMANDS) {
|
|
15
|
+
// Check for various naming patterns across adapters
|
|
16
|
+
const candidates = [
|
|
17
|
+
path.resolve(commandDir, `${deprecatedName}${extension}`),
|
|
18
|
+
path.resolve(commandDir, `clavix-${deprecatedName}${extension}`),
|
|
19
|
+
path.resolve(commandDir, `clavix:${deprecatedName}${extension}`),
|
|
20
|
+
];
|
|
21
|
+
// For Claude Code with subdirectory structure
|
|
22
|
+
if (adapter.name === 'claude-code') {
|
|
23
|
+
const clavixDir = path.resolve(commandDir, 'clavix');
|
|
24
|
+
candidates.push(path.resolve(clavixDir, `${deprecatedName}${extension}`), path.resolve(clavixDir, `clavix-${deprecatedName}${extension}`));
|
|
25
|
+
}
|
|
26
|
+
for (const candidate of candidates) {
|
|
27
|
+
if (await FileSystem.exists(candidate)) {
|
|
28
|
+
legacyPaths.add(candidate);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
7
32
|
for (const name of commandNames) {
|
|
8
33
|
const newFilePath = path.resolve(commandDir, adapter.getTargetFilename(name));
|
|
9
34
|
const defaultFilePath = path.resolve(commandDir, `${name}${extension}`);
|
|
@@ -15,22 +40,24 @@ export async function collectLegacyCommandFiles(adapter, commandNames) {
|
|
|
15
40
|
];
|
|
16
41
|
for (const candidate of oldCandidates) {
|
|
17
42
|
const resolvedCandidate = path.resolve(candidate);
|
|
18
|
-
if (resolvedCandidate !== newFilePath && await FileSystem.exists(resolvedCandidate)) {
|
|
43
|
+
if (resolvedCandidate !== newFilePath && (await FileSystem.exists(resolvedCandidate))) {
|
|
19
44
|
legacyPaths.add(resolvedCandidate);
|
|
20
45
|
}
|
|
21
46
|
}
|
|
22
|
-
if (defaultFilePath !== newFilePath && await FileSystem.exists(defaultFilePath)) {
|
|
47
|
+
if (defaultFilePath !== newFilePath && (await FileSystem.exists(defaultFilePath))) {
|
|
23
48
|
legacyPaths.add(defaultFilePath);
|
|
24
49
|
}
|
|
25
50
|
continue;
|
|
26
51
|
}
|
|
27
52
|
if (adapter.name === 'gemini' || adapter.name === 'qwen') {
|
|
28
53
|
const namespaced = commandDir.endsWith(path.join('commands', 'clavix'));
|
|
29
|
-
if (!namespaced &&
|
|
54
|
+
if (!namespaced &&
|
|
55
|
+
defaultFilePath !== newFilePath &&
|
|
56
|
+
(await FileSystem.exists(defaultFilePath))) {
|
|
30
57
|
legacyPaths.add(defaultFilePath);
|
|
31
58
|
}
|
|
32
59
|
}
|
|
33
|
-
else if (defaultFilePath !== newFilePath && await FileSystem.exists(defaultFilePath)) {
|
|
60
|
+
else if (defaultFilePath !== newFilePath && (await FileSystem.exists(defaultFilePath))) {
|
|
34
61
|
legacyPaths.add(defaultFilePath);
|
|
35
62
|
}
|
|
36
63
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavix",
|
|
3
|
-
"version": "4.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "4.12.0",
|
|
4
|
+
"description": "Prompt optimization for AI coding. Structures prompts with pattern-based intent detection, quality assessment, and workflow management. Works with Claude Code, Cursor, Windsurf, and 19+ other AI coding tools.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"ai",
|
|
43
43
|
"prompt",
|
|
44
44
|
"prompt-optimization",
|
|
45
|
-
"prompt-
|
|
45
|
+
"prompt-structuring",
|
|
46
46
|
"intent-detection",
|
|
47
47
|
"quality-assessment",
|
|
48
48
|
"prd",
|
|
@@ -53,7 +53,8 @@
|
|
|
53
53
|
"developer-tools",
|
|
54
54
|
"prompt-engineering",
|
|
55
55
|
"ai-coding-tools",
|
|
56
|
-
"requirements"
|
|
56
|
+
"requirements",
|
|
57
|
+
"workflow"
|
|
57
58
|
],
|
|
58
59
|
"author": "ClavixDev",
|
|
59
60
|
"license": "Apache-2.0",
|