clavix 4.11.1 → 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/README.md +161 -188
- package/dist/templates/instructions/core/clavix-mode.md +3 -4
- package/dist/templates/instructions/core/verification.md +17 -19
- package/dist/templates/instructions/troubleshooting/jumped-to-implementation.md +1 -1
- package/dist/templates/instructions/troubleshooting/skipped-file-creation.md +7 -7
- package/dist/templates/slash-commands/_canonical/archive.md +1 -1
- package/dist/templates/slash-commands/_canonical/improve.md +1 -1
- package/dist/templates/slash-commands/_canonical/plan.md +1 -1
- package/dist/templates/slash-commands/_canonical/prd.md +2 -2
- package/dist/templates/slash-commands/_canonical/start.md +2 -2
- package/dist/templates/slash-commands/_canonical/summarize.md +9 -9
- package/dist/templates/slash-commands/_canonical/verify.md +8 -8
- package/dist/templates/slash-commands/_components/agent-protocols/decision-rules.md +16 -16
- package/dist/templates/slash-commands/_components/agent-protocols/self-correction.md +4 -4
- package/dist/templates/slash-commands/_components/agent-protocols/state-assertion.md +3 -4
- package/dist/templates/slash-commands/_components/agent-protocols/state-awareness.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/templates/slash-commands/_components/troubleshooting/mode-confusion.md +1 -1
- package/dist/templates/slash-commands/_components/troubleshooting/triage-escalation.md +9 -9
- package/dist/types/config.d.ts +57 -0
- package/dist/utils/legacy-command-cleanup.js +31 -4
- package/package.json +7 -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
|
|