clavix 4.1.1 → 4.2.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.
@@ -242,31 +242,8 @@ clavix start
242
242
  Learn more: https://github.com/clavixdev/clavix`;
243
243
  }
244
244
  getClaudeContent() {
245
- return `## Clavix Integration
246
-
247
- This project uses Clavix for prompt improvement and PRD generation. The following slash commands are available:
248
-
249
- ### /clavix:fast [prompt]
250
- Quick prompt improvements with smart triage. Clavix will analyze your prompt and recommend deep analysis if needed. Perfect for making "shitty prompts good" quickly.
251
-
252
- ### /clavix:deep [prompt]
253
- Comprehensive prompt analysis with alternative phrasings, edge cases, implementation examples, and potential issues. Use for complex requirements or when you want thorough exploration.
254
-
255
- ### /clavix:prd
256
- Launch the PRD generation workflow. Clavix will guide you through strategic questions and generate both a comprehensive PRD and a quick-reference version optimized for AI consumption.
257
-
258
- ### /clavix:start
259
- Enter conversational mode for iterative prompt development. Discuss your requirements naturally, and later use \`/clavix:summarize\` to extract an optimized prompt.
260
-
261
- ### /clavix:summarize
262
- Analyze the current conversation and extract key requirements into a structured prompt and mini-PRD.
263
-
264
- **When to use which mode:**
265
- - **Fast mode** (\`/clavix:fast\`): Quick cleanup for simple prompts
266
- - **Deep mode** (\`/clavix:deep\`): Comprehensive analysis for complex requirements
267
- - **PRD mode** (\`/clavix:prd\`): Strategic planning with architecture and business impact
268
-
269
- **Pro tip**: Start complex features with \`/clavix:prd\` or \`/clavix:start\` to ensure clear requirements before implementation.`;
245
+ // Use DocInjector as single source of truth for CLAUDE.md content
246
+ return DocInjector.getClaudeBlockContent();
270
247
  }
271
248
  hasUpToDateBlock(currentContent, newContent) {
272
249
  // Check if the managed block contains the new content
@@ -43,6 +43,11 @@ export declare class DocInjector {
43
43
  * Create default AGENTS.md content
44
44
  */
45
45
  static getDefaultAgentsContent(): string;
46
+ /**
47
+ * Create the CLAUDE.md block content (without file wrapper)
48
+ * This is the single source of truth for Claude Code documentation
49
+ */
50
+ static getClaudeBlockContent(): string;
46
51
  /**
47
52
  * Create default CLAUDE.md content for Claude Code
48
53
  */
@@ -161,37 +161,73 @@ For more information, run \`clavix --help\` in your terminal.
161
161
  `;
162
162
  }
163
163
  /**
164
- * Create default CLAUDE.md content for Claude Code
164
+ * Create the CLAUDE.md block content (without file wrapper)
165
+ * This is the single source of truth for Claude Code documentation
165
166
  */
166
- static getDefaultClaudeContent() {
167
- return `# Claude Code Instructions
168
-
169
- <!-- CLAVIX:START -->
170
- ## Clavix Integration
167
+ static getClaudeBlockContent() {
168
+ return `## Clavix Integration
171
169
 
172
170
  This project uses Clavix for prompt improvement and PRD generation. The following slash commands are available:
173
171
 
174
- ### /clavix:fast [prompt]
172
+ ### Prompt Optimization Commands
173
+
174
+ #### /clavix:fast [prompt]
175
175
  Quick prompt improvements with smart triage. Clavix will analyze your prompt and recommend deep analysis if needed. Perfect for making "shitty prompts good" quickly.
176
176
 
177
- ### /clavix:deep [prompt]
177
+ #### /clavix:deep [prompt]
178
178
  Comprehensive prompt analysis with alternative phrasings, edge cases, implementation examples, and potential issues. Use for complex requirements or when you want thorough exploration.
179
179
 
180
- ### /clavix:prd
180
+ ### PRD & Planning Commands
181
+
182
+ #### /clavix:prd
181
183
  Launch the PRD generation workflow. Clavix will guide you through strategic questions and generate both a comprehensive PRD and a quick-reference version optimized for AI consumption.
182
184
 
183
- ### /clavix:start
185
+ #### /clavix:plan
186
+ Generate an optimized implementation task breakdown from your PRD. Creates a phased task plan with dependencies and priorities.
187
+
188
+ #### /clavix:implement
189
+ Execute tasks from your task plan with AI assistance. Supports automatic git commits and progress tracking.
190
+
191
+ ### Session Management Commands
192
+
193
+ #### /clavix:start
184
194
  Enter conversational mode for iterative prompt development. Discuss your requirements naturally, and later use \`/clavix:summarize\` to extract an optimized prompt.
185
195
 
186
- ### /clavix:summarize
196
+ #### /clavix:summarize
187
197
  Analyze the current conversation and extract key requirements into a structured prompt and mini-PRD.
188
198
 
199
+ ### Utility Commands
200
+
201
+ #### /clavix:execute
202
+ Run saved prompts with lifecycle awareness. Execute previously saved fast/deep prompts.
203
+
204
+ #### /clavix:prompts
205
+ Manage your saved fast/deep prompts. List, view, and organize your prompt library.
206
+
207
+ #### /clavix:archive
208
+ Archive completed projects. Move finished PRDs and outputs to the archive for future reference.
209
+
189
210
  **When to use which mode:**
190
211
  - **Fast mode** (\`/clavix:fast\`): Quick cleanup for simple prompts
191
212
  - **Deep mode** (\`/clavix:deep\`): Comprehensive analysis for complex requirements
192
213
  - **PRD mode** (\`/clavix:prd\`): Strategic planning with architecture and business impact
193
214
 
194
- **Pro tip**: Start complex features with \`/clavix:prd\` or \`/clavix:start\` to ensure clear requirements before implementation.
215
+ **Recommended Workflow:**
216
+ 1. Start with \`/clavix:prd\` or \`/clavix:start\` for complex features
217
+ 2. Generate tasks with \`/clavix:plan\`
218
+ 3. Implement with \`/clavix:implement\`
219
+ 4. Archive when complete with \`/clavix:archive\`
220
+
221
+ **Pro tip**: Start complex features with \`/clavix:prd\` or \`/clavix:start\` to ensure clear requirements before implementation.`;
222
+ }
223
+ /**
224
+ * Create default CLAUDE.md content for Claude Code
225
+ */
226
+ static getDefaultClaudeContent() {
227
+ return `# Claude Code Instructions
228
+
229
+ <!-- CLAVIX:START -->
230
+ ${this.getClaudeBlockContent()}
195
231
  <!-- CLAVIX:END -->
196
232
  `;
197
233
  }
@@ -33,17 +33,35 @@ For complete mode documentation, see: `.clavix/instructions/core/clavix-mode.md`
33
33
 
34
34
  ## Self-Correction Protocol
35
35
 
36
- **DETECT**: If you find yourself:
37
- - Writing function/class definitions for the user's feature
38
- - Creating component implementations
39
- - Generating API endpoint code
36
+ **DETECT**: If you find yourself doing any of these 6 mistake types:
40
37
 
41
- **STOP**: Immediately halt code generation
38
+ | Type | What It Looks Like |
39
+ |------|--------------------|
40
+ | 1. Implementation Code | Writing function/class definitions, creating components, generating API endpoints, test files, database schemas, or configuration files for the user's feature |
41
+ | 2. Skipping Quality Assessment | Not scoring all 6 dimensions, providing analysis without showing dimension breakdown |
42
+ | 3. Missing Alternatives | Not generating 2-3 alternative approaches in deep mode |
43
+ | 4. Missing Validation Checklist | Not creating verification checklist for implementation |
44
+ | 5. Missing Edge Cases | Not identifying potential edge cases and failure modes |
45
+ | 6. Capability Hallucination | Claiming features Clavix doesn't have, inventing pattern names |
46
+
47
+ **STOP**: Immediately halt the incorrect action
42
48
 
43
49
  **CORRECT**: Output:
44
- "I apologize - I was implementing instead of analyzing. Let me return to deep prompt analysis."
50
+ "I apologize - I was [describe mistake]. Let me return to deep prompt analysis."
51
+
52
+ **RESUME**: Return to the deep prompt analysis workflow with all required outputs.
53
+
54
+ ---
45
55
 
46
- **RESUME**: Return to the deep prompt analysis workflow.
56
+ ## State Assertion (Required)
57
+
58
+ **Before starting analysis, output:**
59
+ ```
60
+ **CLAVIX MODE: Deep Analysis**
61
+ Mode: planning
62
+ Purpose: Comprehensive prompt analysis with alternatives, edge cases, and validation
63
+ Implementation: BLOCKED - I will analyze the prompt thoroughly, not implement it
64
+ ```
47
65
 
48
66
  ---
49
67
 
@@ -53,7 +71,7 @@ Deep mode provides **Clavix Intelligence™** with comprehensive analysis that g
53
71
 
54
72
  **Deep Mode Features:**
55
73
  - **Intent Detection**: Identifies what you're trying to achieve
56
- - **Quality Assessment**: 5-dimension deep analysis (Clarity, Efficiency, Structure, Completeness, Actionability)
74
+ - **Quality Assessment**: 6-dimension deep analysis (Clarity, Efficiency, Structure, Completeness, Actionability, Specificity)
57
75
  - **Advanced Optimization**: Applies all available patterns
58
76
  - **Alternative Approaches**: Multiple ways to phrase and structure your prompt
59
77
  - **Edge Case Analysis**: Identifies potential issues and failure modes
@@ -71,6 +89,10 @@ Deep mode provides **Clavix Intelligence™** with comprehensive analysis that g
71
89
  - **debugging**: Finding and fixing issues
72
90
  - **documentation**: Creating docs or explanations
73
91
  - **prd-generation**: Creating requirements documents
92
+ - **testing**: Writing tests, improving test coverage
93
+ - **migration**: Version upgrades, porting code between frameworks
94
+ - **security-review**: Security audits, vulnerability checks
95
+ - **learning**: Conceptual understanding, tutorials, explanations
74
96
 
75
97
  3. **Strategic Scope Detection** (before detailed analysis):
76
98
 
@@ -88,13 +110,14 @@ Deep mode provides **Clavix Intelligence™** with comprehensive analysis that g
88
110
 
89
111
  **If user chooses to continue**, proceed with deep analysis but remind them at the end that `/clavix:prd` is available for strategic planning.
90
112
 
91
- 4. **Comprehensive Quality Assessment** - Evaluate across 5 dimensions:
113
+ 4. **Comprehensive Quality Assessment** - Evaluate across 6 dimensions:
92
114
 
93
115
  - **Clarity**: Is the objective clear and unambiguous?
94
116
  - **Efficiency**: Is the prompt concise without losing critical information?
95
117
  - **Structure**: Is information organized logically?
96
118
  - **Completeness**: Are all necessary details provided?
97
119
  - **Actionability**: Can AI take immediate action on this prompt?
120
+ - **Specificity**: How concrete and precise is the prompt? (versions, paths, identifiers)
98
121
 
99
122
  Score each dimension 0-100%, calculate weighted overall score.
100
123
 
@@ -102,7 +125,7 @@ Deep mode provides **Clavix Intelligence™** with comprehensive analysis that g
102
125
 
103
126
  a. **Intent Analysis** (type, confidence, characteristics)
104
127
 
105
- b. **Quality Assessment** (5 dimensions with detailed feedback)
128
+ b. **Quality Assessment** (6 dimensions with detailed feedback)
106
129
 
107
130
  c. **Optimized Prompt** (applying all patterns)
108
131
 
@@ -146,7 +169,7 @@ Deep mode provides **Clavix Intelligence™** with comprehensive analysis that g
146
169
 
147
170
  **Include:**
148
171
  - **Intent Detection**: Automatic classification with confidence
149
- - **Quality Assessment**: All 5 dimensions with detailed analysis
172
+ - **Quality Assessment**: All 6 dimensions with detailed analysis
150
173
  - **Advanced Optimization**: All applicable patterns
151
174
  - **Alternative Approaches**: Multiple phrasings and perspectives
152
175
  - **Alternative Structures**: Different organization approaches
@@ -180,6 +203,9 @@ Deep mode has access to all patterns including deep-exclusive patterns:
180
203
  - **ValidationChecklistCreator**: Creates implementation verification checklist
181
204
  - **AssumptionExplicitizer**: Makes implicit assumptions explicit
182
205
  - **ScopeDefiner**: Adds explicit scope boundaries
206
+ - **PRDStructureEnforcer**: Ensures PRD completeness (PRD mode only)
207
+ - **ErrorToleranceEnhancer**: Adds error handling requirements
208
+ - **PrerequisiteIdentifier**: Identifies prerequisites and dependencies
183
209
 
184
210
  ---
185
211
 
@@ -32,17 +32,35 @@ For complete mode documentation, see: `.clavix/instructions/core/clavix-mode.md`
32
32
 
33
33
  ## Self-Correction Protocol
34
34
 
35
- **DETECT**: If you find yourself:
36
- - Writing function/class definitions for the user's feature
37
- - Creating component implementations
38
- - Generating API endpoint code
35
+ **DETECT**: If you find yourself doing any of these 6 mistake types:
39
36
 
40
- **STOP**: Immediately halt code generation
37
+ | Type | What It Looks Like |
38
+ |------|--------------------|
39
+ | 1. Implementation Code | Writing function/class definitions, creating components, generating API endpoints, test files, database schemas, or configuration files for the user's feature |
40
+ | 2. Skipping Quality Assessment | Not scoring all 6 dimensions, jumping to improved prompt without analysis |
41
+ | 3. Wrong Mode Selection | Not suggesting `/clavix:deep` when quality <65% or escalation factors present |
42
+ | 4. Incomplete Pattern Application | Not showing which patterns were applied, skipping patterns without explanation |
43
+ | 5. Missing Triage | Not evaluating if deep mode is needed, ignoring secondary indicators |
44
+ | 6. Capability Hallucination | Claiming features Clavix doesn't have, inventing pattern names |
45
+
46
+ **STOP**: Immediately halt the incorrect action
41
47
 
42
48
  **CORRECT**: Output:
43
- "I apologize - I was implementing instead of optimizing the prompt. Let me return to prompt optimization."
49
+ "I apologize - I was [describe mistake]. Let me return to prompt optimization."
50
+
51
+ **RESUME**: Return to the prompt optimization workflow with correct approach.
52
+
53
+ ---
44
54
 
45
- **RESUME**: Return to the prompt optimization workflow.
55
+ ## State Assertion (Required)
56
+
57
+ **Before starting analysis, output:**
58
+ ```
59
+ **CLAVIX MODE: Fast Optimization**
60
+ Mode: planning
61
+ Purpose: Optimizing user prompt with Clavix Intelligence™
62
+ Implementation: BLOCKED - I will analyze and improve the prompt, not implement it
63
+ ```
46
64
 
47
65
  ---
48
66
 
@@ -52,7 +70,7 @@ Clavix provides **Clavix Intelligence™** that automatically detects intent and
52
70
 
53
71
  **Fast Mode Features:**
54
72
  - **Intent Detection**: Automatically identifies what you're trying to achieve
55
- - **Quality Assessment**: 5-dimension analysis (Clarity, Efficiency, Structure, Completeness, Actionability)
73
+ - **Quality Assessment**: 6-dimension analysis (Clarity, Efficiency, Structure, Completeness, Actionability, Specificity)
56
74
  - **Smart Optimization**: Applies proven patterns based on your intent
57
75
  - **Intelligent Triage**: Recommends deep mode when comprehensive analysis would help
58
76
 
@@ -69,14 +87,19 @@ Clavix provides **Clavix Intelligence™** that automatically detects intent and
69
87
  - **debugging**: Finding and fixing issues
70
88
  - **documentation**: Creating docs or explanations
71
89
  - **prd-generation**: Creating requirements documents
90
+ - **testing**: Writing tests, improving test coverage
91
+ - **migration**: Version upgrades, porting code between frameworks
92
+ - **security-review**: Security audits, vulnerability checks
93
+ - **learning**: Conceptual understanding, tutorials, explanations
72
94
 
73
- 3. **Quality Assessment** - Evaluate across 5 dimensions:
95
+ 3. **Quality Assessment** - Evaluate across 6 dimensions:
74
96
 
75
97
  - **Clarity**: Is the objective clear and unambiguous?
76
98
  - **Efficiency**: Is the prompt concise without losing critical information?
77
99
  - **Structure**: Is information organized logically?
78
100
  - **Completeness**: Are all necessary details provided?
79
101
  - **Actionability**: Can AI take immediate action on this prompt?
102
+ - **Specificity**: How concrete and precise is the prompt? (versions, paths, identifiers)
80
103
 
81
104
  Score each dimension 0-100%, calculate weighted overall score.
82
105
 
@@ -33,17 +33,35 @@ For complete mode documentation, see: `.clavix/instructions/core/clavix-mode.md`
33
33
 
34
34
  ## Self-Correction Protocol
35
35
 
36
- **DETECT**: If you find yourself:
37
- - Writing function/class definitions for the user's feature
38
- - Creating component implementations
39
- - Generating API endpoint code
36
+ **DETECT**: If you find yourself doing any of these 6 mistake types:
40
37
 
41
- **STOP**: Immediately halt code generation
38
+ | Type | What It Looks Like |
39
+ |------|--------------------|
40
+ | 1. Implementation Code | Writing function/class definitions, creating components, generating API endpoints, test files, database schemas, or configuration files for the user's feature |
41
+ | 2. Skipping PRD Analysis | Not reading and analyzing the PRD before generating tasks |
42
+ | 3. Non-Atomic Tasks | Creating tasks that are too large or vague to be actionable |
43
+ | 4. Missing Task IDs | Not assigning proper task IDs and references |
44
+ | 5. Missing Phase Organization | Not organizing tasks into logical implementation phases |
45
+ | 6. Capability Hallucination | Claiming features Clavix doesn't have, inventing task formats |
46
+
47
+ **STOP**: Immediately halt the incorrect action
42
48
 
43
49
  **CORRECT**: Output:
44
- "I apologize - I was implementing instead of planning. Let me return to task breakdown generation."
50
+ "I apologize - I was [describe mistake]. Let me return to task breakdown generation."
51
+
52
+ **RESUME**: Return to the task breakdown generation workflow with correct approach.
53
+
54
+ ---
45
55
 
46
- **RESUME**: Return to the task breakdown generation workflow.
56
+ ## State Assertion (Required)
57
+
58
+ **Before starting task breakdown, output:**
59
+ ```
60
+ **CLAVIX MODE: Task Planning**
61
+ Mode: planning
62
+ Purpose: Generating implementation task breakdown from PRD
63
+ Implementation: BLOCKED - I will create tasks, not implement them
64
+ ```
47
65
 
48
66
  ---
49
67
 
@@ -33,17 +33,35 @@ For complete mode documentation, see: `.clavix/instructions/core/clavix-mode.md`
33
33
 
34
34
  ## Self-Correction Protocol
35
35
 
36
- **DETECT**: If you find yourself:
37
- - Writing function/class definitions for the user's feature
38
- - Creating component implementations
39
- - Generating API endpoint code
36
+ **DETECT**: If you find yourself doing any of these 6 mistake types:
40
37
 
41
- **STOP**: Immediately halt code generation
38
+ | Type | What It Looks Like |
39
+ |------|--------------------|
40
+ | 1. Implementation Code | Writing function/class definitions, creating components, generating API endpoints, test files, database schemas, or configuration files for the user's feature |
41
+ | 2. Skipping Strategic Questions | Not asking about problem, users, features, constraints, or success metrics |
42
+ | 3. Incomplete PRD Structure | Missing sections: problem statement, user needs, requirements, constraints |
43
+ | 4. No Quick PRD | Not generating the AI-optimized 2-3 paragraph version alongside full PRD |
44
+ | 5. Missing Task Breakdown | Not offering to generate tasks.md with actionable implementation tasks |
45
+ | 6. Capability Hallucination | Claiming features Clavix doesn't have, inventing workflows |
46
+
47
+ **STOP**: Immediately halt the incorrect action
42
48
 
43
49
  **CORRECT**: Output:
44
- "I apologize - I was implementing instead of developing the PRD. Let me return to requirements gathering."
50
+ "I apologize - I was [describe mistake]. Let me return to PRD development."
51
+
52
+ **RESUME**: Return to the PRD development workflow with strategic questioning.
53
+
54
+ ---
45
55
 
46
- **RESUME**: Return to the PRD development workflow.
56
+ ## State Assertion (Required)
57
+
58
+ **Before starting PRD development, output:**
59
+ ```
60
+ **CLAVIX MODE: PRD Development**
61
+ Mode: planning
62
+ Purpose: Guiding strategic questions to create comprehensive PRD documents
63
+ Implementation: BLOCKED - I will develop requirements, not implement the feature
64
+ ```
47
65
 
48
66
  ---
49
67
 
@@ -33,17 +33,35 @@ For complete mode documentation, see: `.clavix/instructions/core/clavix-mode.md`
33
33
 
34
34
  ## Self-Correction Protocol
35
35
 
36
- **DETECT**: If you find yourself:
37
- - Writing function/class definitions for the user's feature
38
- - Creating component implementations
39
- - Generating API endpoint code
36
+ **DETECT**: If you find yourself doing any of these 6 mistake types:
40
37
 
41
- **STOP**: Immediately halt code generation
38
+ | Type | What It Looks Like |
39
+ |------|--------------------|
40
+ | 1. Implementation Code | Writing function/class definitions, creating components, generating API endpoints, test files, database schemas, or configuration files for the user's feature |
41
+ | 2. Not Asking Questions | Assuming requirements instead of asking clarifying questions |
42
+ | 3. Premature Summarization | Extracting requirements before the conversation is complete |
43
+ | 4. Ignoring Multi-Topic Detection | Not suggesting focus when 3+ distinct topics are detected |
44
+ | 5. Missing Requirement Tracking | Not tracking problem statement, users, features, constraints, success criteria |
45
+ | 6. Capability Hallucination | Claiming features Clavix doesn't have, inventing workflows |
46
+
47
+ **STOP**: Immediately halt the incorrect action
42
48
 
43
49
  **CORRECT**: Output:
44
- "I apologize - I was implementing instead of gathering requirements. Let me return to our requirements discussion."
50
+ "I apologize - I was [describe mistake]. Let me return to our requirements discussion."
51
+
52
+ **RESUME**: Return to the requirements gathering workflow with clarifying questions.
53
+
54
+ ---
55
+
56
+ ## State Assertion (Required)
45
57
 
46
- **RESUME**: Return to the requirements gathering workflow.
58
+ **Before starting conversation, output:**
59
+ ```
60
+ **CLAVIX MODE: Conversational Requirements**
61
+ Mode: planning
62
+ Purpose: Gathering requirements through iterative discussion
63
+ Implementation: BLOCKED - I will ask questions and explore needs, not implement
64
+ ```
47
65
 
48
66
  ---
49
67
 
@@ -33,17 +33,35 @@ For complete mode documentation, see: `.clavix/instructions/core/clavix-mode.md`
33
33
 
34
34
  ## Self-Correction Protocol
35
35
 
36
- **DETECT**: If you find yourself:
37
- - Writing function/class definitions for the user's feature
38
- - Creating component implementations
39
- - Generating API endpoint code
36
+ **DETECT**: If you find yourself doing any of these 6 mistake types:
40
37
 
41
- **STOP**: Immediately halt code generation
38
+ | Type | What It Looks Like |
39
+ |------|--------------------|
40
+ | 1. Implementation Code | Writing function/class definitions, creating components, generating API endpoints, test files, database schemas, or configuration files for the user's feature |
41
+ | 2. Skipping Pre-Validation | Not checking conversation completeness before extracting requirements |
42
+ | 3. Missing Confidence Indicators | Not annotating requirements with [HIGH], [MEDIUM], [LOW] confidence |
43
+ | 4. Not Creating Output Files | Not creating mini-prd.md, optimized-prompt.md, and quick-prd.md files |
44
+ | 5. No Clavix Intelligence™ Applied | Not applying quality patterns to extracted requirements |
45
+ | 6. Capability Hallucination | Claiming features Clavix doesn't have, inventing workflows |
46
+
47
+ **STOP**: Immediately halt the incorrect action
42
48
 
43
49
  **CORRECT**: Output:
44
- "I apologize - I was implementing instead of extracting requirements. Let me return to requirements extraction."
50
+ "I apologize - I was [describe mistake]. Let me return to requirements extraction."
51
+
52
+ **RESUME**: Return to the requirements extraction workflow with validation and file creation.
53
+
54
+ ---
45
55
 
46
- **RESUME**: Return to the requirements extraction workflow.
56
+ ## State Assertion (Required)
57
+
58
+ **Before starting extraction, output:**
59
+ ```
60
+ **CLAVIX MODE: Requirements Extraction**
61
+ Mode: planning
62
+ Purpose: Extracting and optimizing requirements from conversation
63
+ Implementation: BLOCKED - I will extract requirements, not implement them
64
+ ```
47
65
 
48
66
  ---
49
67
 
@@ -107,6 +107,83 @@ AFTER writing files:
107
107
  → IF failed: Report error, suggest manual action
108
108
  ```
109
109
 
110
+ ### Rule 7: Pattern Application Decision
111
+
112
+ ```
113
+ WHEN applying patterns:
114
+ → ALWAYS show which patterns were applied
115
+ → LIST each pattern with its effect
116
+
117
+ IF pattern not applicable to intent:
118
+ → SKIP silently (no output)
119
+
120
+ IF pattern applicable but skipped:
121
+ → EXPLAIN: "Skipped [pattern] because [reason]"
122
+
123
+ DEEP MODE ONLY:
124
+ → MUST include alternatives (2-3)
125
+ → MUST include validation checklist
126
+ → MUST include edge cases
127
+ ```
128
+
129
+ ### Rule 8: Mode Transition Decision
130
+
131
+ ```
132
+ IF user requests /clavix:fast but quality < 50%:
133
+ → ACTION: Warn and suggest deep
134
+ → SAY: "Quality is [X]%. Fast mode may be insufficient."
135
+ → ALLOW: User can override and proceed
136
+
137
+ IF user in /clavix:deep but prompt is simple (quality > 85%):
138
+ → ACTION: Note efficiency
139
+ → SAY: "Prompt is already high quality. Fast mode would suffice."
140
+ → CONTINUE: With deep analysis anyway
141
+
142
+ IF strategic keywords detected (3+ architecture/security/scalability):
143
+ → ACTION: Suggest PRD mode
144
+ → SAY: "Detected strategic scope. Consider /clavix:prd for comprehensive planning."
145
+ ```
146
+
147
+ ### Rule 9: Output Validation Decision
148
+
149
+ ```
150
+ BEFORE presenting optimized prompt:
151
+ → VERIFY: All 6 quality dimensions scored
152
+ → VERIFY: Intent detected with confidence shown
153
+ → VERIFY: Patterns applied are listed
154
+
155
+ IF any verification fails:
156
+ → HALT: Do not present incomplete output
157
+ → ACTION: Complete missing analysis first
158
+
159
+ AFTER optimization complete:
160
+ → MUST save prompt to .clavix/outputs/prompts/
161
+ → MUST update index file
162
+ → SHOW: "✓ Prompt saved: [filename]"
163
+ ```
164
+
165
+ ### Rule 10: Error Recovery Decision
166
+
167
+ ```
168
+ IF pattern application fails:
169
+ → LOG: Which pattern failed
170
+ → CONTINUE: With remaining patterns
171
+ → REPORT: "Pattern [X] skipped due to error"
172
+
173
+ IF file write fails:
174
+ → RETRY: Once with alternative path
175
+ → IF still fails: Report error with manual steps
176
+
177
+ IF CLI command fails:
178
+ → SHOW: Command output and error
179
+ → SUGGEST: Alternative action
180
+ → NEVER: Silently ignore failures
181
+
182
+ IF user prompt is empty/invalid:
183
+ → ASK: For valid input
184
+ → NEVER: Proceed with assumption
185
+ ```
186
+
110
187
  ### Rule Summary Table
111
188
 
112
189
  | Condition | Action | User Communication |
@@ -121,3 +198,7 @@ AFTER writing files:
121
198
  | escalation >= 75 | Strong recommend | Show top 3 factors |
122
199
  | escalation 45-74 | Suggest | Show primary factor |
123
200
  | escalation < 45 | No action | Silent |
201
+ | fast requested + quality < 50% | Warn | "Quality low, consider deep" |
202
+ | 3+ strategic keywords | Suggest PRD | "Strategic scope detected" |
203
+ | pattern fails | Skip + report | "Pattern [X] skipped" |
204
+ | file write fails | Retry then report | "Error: [details]" |
@@ -0,0 +1,42 @@
1
+ ## Self-Correction Protocol
2
+
3
+ **DETECT**: If you find yourself doing any of these 6 mistake types:
4
+
5
+ ### Mistake Type 1: Implementation Code
6
+ - Writing function/class definitions for the user's feature
7
+ - Creating component implementations
8
+ - Generating API endpoint code
9
+ - Writing test files for the user's feature
10
+ - Creating database schemas/migrations
11
+ - Writing configuration files for deployment
12
+
13
+ ### Mistake Type 2: Skipping Quality Assessment
14
+ - Not scoring all 6 quality dimensions
15
+ - Providing optimization without quality analysis
16
+ - Jumping directly to improved prompt without showing scores
17
+
18
+ ### Mistake Type 3: Wrong Mode Selection
19
+ - Not suggesting `/clavix:deep` when quality scores are low
20
+ - Not recommending `/clavix:prd` for strategic decisions
21
+ - Ignoring triage indicators and escalation factors
22
+
23
+ ### Mistake Type 4: Incomplete Pattern Application
24
+ - Not applying all applicable patterns for the detected intent
25
+ - Skipping patterns without explanation
26
+ - Not showing which patterns were applied
27
+
28
+ ### Mistake Type 5: Missing Validation (Deep Mode)
29
+ - Not generating validation checklist in deep mode
30
+ - Not identifying edge cases
31
+ - Not providing alternative approaches
32
+
33
+ ### Mistake Type 6: Capability Hallucination
34
+ - Claiming features Clavix doesn't have
35
+ - Inventing pattern names that don't exist
36
+ - Describing workflows that aren't documented
37
+
38
+ **STOP**: Immediately halt the incorrect action
39
+
40
+ **CORRECT**: Output an acknowledgment and return to correct workflow
41
+
42
+ **RESUME**: Return to the appropriate Clavix workflow for this mode
@@ -0,0 +1,52 @@
1
+ ## Mode State Assertion (Mandatory)
2
+
3
+ **At the start of every Clavix workflow, assert your current mode state.**
4
+
5
+ ### State Assertion Format
6
+
7
+ Output this block before beginning any analysis:
8
+
9
+ ```
10
+ **CLAVIX MODE: [Mode Name]**
11
+ Mode: [planning|implementation]
12
+ Purpose: [Brief purpose description]
13
+ Implementation: [BLOCKED|ALLOWED]
14
+ ```
15
+
16
+ ### Mode State Definitions
17
+
18
+ | Mode | Type | Implementation | Purpose |
19
+ |------|------|----------------|---------|
20
+ | /clavix:fast | planning | BLOCKED | Prompt optimization |
21
+ | /clavix:deep | planning | BLOCKED | Comprehensive prompt analysis |
22
+ | /clavix:prd | planning | BLOCKED | PRD development |
23
+ | /clavix:plan | planning | BLOCKED | Task breakdown generation |
24
+ | /clavix:start | planning | BLOCKED | Requirements gathering |
25
+ | /clavix:summarize | planning | BLOCKED | Requirements extraction |
26
+ | /clavix:implement | implementation | ALLOWED | Feature implementation |
27
+ | /clavix:execute | implementation | ALLOWED | Prompt execution |
28
+
29
+ ### Why State Assertion Matters
30
+
31
+ 1. **Prevents mode confusion**: Agent explicitly acknowledges what it can/cannot do
32
+ 2. **Blocks premature implementation**: Implementation BLOCKED modes cannot write feature code
33
+ 3. **Enables self-monitoring**: Agent can detect drift from declared state
34
+ 4. **Provides audit trail**: User sees what mode agent thinks it's in
35
+
36
+ ### Example Assertions
37
+
38
+ **Planning Mode (Implementation BLOCKED):**
39
+ ```
40
+ **CLAVIX MODE: Fast Optimization**
41
+ Mode: planning
42
+ Purpose: Optimizing user prompt with Clavix Intelligence™
43
+ Implementation: BLOCKED - I will analyze and improve the prompt, not implement it
44
+ ```
45
+
46
+ **Implementation Mode (Implementation ALLOWED):**
47
+ ```
48
+ **CLAVIX MODE: Implementation**
49
+ Mode: implementation
50
+ Purpose: Implementing tasks from PRD/prompt
51
+ Implementation: ALLOWED - I will write production code following specifications
52
+ ```
@@ -0,0 +1,37 @@
1
+ ## Intent Types Reference
2
+
3
+ Clavix Intelligence™ detects 10 primary intent types. This reference is synchronized with `src/core/intelligence/types.ts`.
4
+
5
+ ### Intent Categories
6
+
7
+ | Intent | Description | Key Indicators |
8
+ |--------|-------------|----------------|
9
+ | **code-generation** | Writing new code or functions | "create", "build", "implement", "write" |
10
+ | **planning** | Designing architecture or breaking down tasks | "design", "architect", "plan", "structure" |
11
+ | **refinement** | Improving existing code or prompts | "improve", "refactor", "optimize", "enhance" |
12
+ | **debugging** | Finding and fixing issues | "fix", "debug", "error", "issue", "bug" |
13
+ | **documentation** | Creating docs or explanations | "document", "explain", "describe", "readme" |
14
+ | **prd-generation** | Creating requirements documents | "PRD", "requirements", "specification", "feature spec" |
15
+ | **testing** | Writing tests, improving test coverage | "test", "coverage", "spec", "unit test", "integration" |
16
+ | **migration** | Version upgrades, porting code | "migrate", "upgrade", "port", "convert", "transition" |
17
+ | **security-review** | Security audits, vulnerability checks | "security", "audit", "vulnerability", "OWASP", "CVE" |
18
+ | **learning** | Conceptual understanding, tutorials | "explain", "how does", "tutorial", "understand" |
19
+
20
+ ### Intent Detection Confidence Levels
21
+
22
+ | Confidence | Meaning | Agent Behavior |
23
+ |------------|---------|----------------|
24
+ | 85%+ | High confidence | Proceed with detected intent |
25
+ | 70-84% | Moderate | Show primary + secondary intent |
26
+ | 50-69% | Low | Ask user to confirm |
27
+ | <50% | Uncertain | Present options, ask for clarification |
28
+
29
+ ### Intent-Specific Patterns
30
+
31
+ Different intents enable different optimization patterns:
32
+
33
+ - **code-generation**: All core patterns + ErrorToleranceEnhancer
34
+ - **planning**: StructureOrganizer, ScopeDefiner, PrerequisiteIdentifier
35
+ - **debugging**: ErrorToleranceEnhancer, EdgeCaseIdentifier
36
+ - **testing**: ValidationChecklistCreator, EdgeCaseIdentifier
37
+ - **prd-generation**: PRDStructureEnforcer, CompletenessValidator
@@ -0,0 +1,54 @@
1
+ ## Quality Dimensions Reference
2
+
3
+ Clavix Intelligence™ assesses prompts across 6 quality dimensions. This reference is synchronized with `src/core/intelligence/types.ts`.
4
+
5
+ ### The 6 Quality Dimensions
6
+
7
+ | Dimension | What It Measures | Low Score Indicators |
8
+ |-----------|------------------|---------------------|
9
+ | **Clarity** | Is the objective clear and unambiguous? | Vague goals, ambiguous terms, unclear scope |
10
+ | **Efficiency** | Is the prompt concise without losing critical info? | Filler words, pleasantries, redundant phrases |
11
+ | **Structure** | Is information organized logically? | No clear sections, random order, missing flow |
12
+ | **Completeness** | Are all necessary details provided? | Missing context, no constraints, no success criteria |
13
+ | **Actionability** | Can AI take immediate action on this prompt? | Too abstract, needs clarification, missing specifics |
14
+ | **Specificity** | How concrete and precise is the prompt? | Vague terms, no versions/paths/identifiers |
15
+
16
+ ### Quality Score Thresholds
17
+
18
+ | Score Range | Rating | Recommendation |
19
+ |-------------|--------|----------------|
20
+ | 80-100% | excellent | Ready to execute |
21
+ | 65-79% | good | Minor improvements suggested |
22
+ | 50-64% | needs-improvement | Consider deep mode |
23
+ | 0-49% | poor | Deep mode strongly recommended |
24
+
25
+ ### Dimension Weights
26
+
27
+ For overall quality calculation:
28
+
29
+ | Dimension | Weight | Rationale |
30
+ |-----------|--------|-----------|
31
+ | Clarity | 20% | Foundation for understanding |
32
+ | Efficiency | 10% | Reduces token usage |
33
+ | Structure | 15% | Enables systematic processing |
34
+ | Completeness | 25% | Most critical for good output |
35
+ | Actionability | 20% | Enables immediate execution |
36
+ | Specificity | 10% | Reduces ambiguity |
37
+
38
+ ### Critical Dimensions
39
+
40
+ If any of these dimensions score below 50%, strongly recommend deep mode:
41
+ - **Clarity** (can't understand the goal)
42
+ - **Completeness** (missing essential information)
43
+ - **Actionability** (can't start without more info)
44
+
45
+ ### Improvement Patterns by Dimension
46
+
47
+ | Dimension | Primary Patterns |
48
+ |-----------|-----------------|
49
+ | Clarity | ObjectiveClarifier, AmbiguityDetector |
50
+ | Efficiency | ConcisenessFilter |
51
+ | Structure | StructureOrganizer, StepDecomposer |
52
+ | Completeness | CompletenessValidator, TechnicalContextEnricher |
53
+ | Actionability | ActionabilityEnhancer, OutputFormatEnforcer |
54
+ | Specificity | ContextPrecisionBooster, DomainContextEnricher |
@@ -46,12 +46,12 @@ Patterns: 7 applied (deep mode)
46
46
  **Core Patterns (fast + deep):**
47
47
  | Pattern | Priority | What It Does |
48
48
  |---------|----------|--------------|
49
- | ConcisenessFilter | 8 | Removes pleasantries, filler words, redundant phrases |
49
+ | ConcisenessFilter | 10 | Removes pleasantries, filler words, redundant phrases |
50
50
  | ObjectiveClarifier | 9 | Adds clear objective/goal statement if missing |
51
51
  | StructureOrganizer | 8 | Reorders into logical flow: context→requirements→constraints→output |
52
52
  | ActionabilityEnhancer | 7 | Converts vague language to specific, actionable terms |
53
- | TechnicalContextEnricher | 6 | Adds missing technical context (frameworks, tools, versions) |
54
- | CompletenessValidator | 5 | Identifies and flags missing required elements |
53
+ | TechnicalContextEnricher | 8 | Adds missing technical context (frameworks, tools, versions) |
54
+ | CompletenessValidator | 6 | Identifies and flags missing required elements |
55
55
  | StepDecomposer | 7 | Breaks complex prompts into sequential steps |
56
56
  | ContextPrecisionBooster | 8 | Adds precise context when missing |
57
57
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavix",
3
- "version": "4.1.1",
3
+ "version": "4.2.0",
4
4
  "description": "Clavix Intelligence™ for AI coding. Automatically optimizes prompts with intent detection, quality assessment, and adaptive patterns—no framework to learn. Works with Claude Code, Cursor, Windsurf, and 19+ other AI coding tools.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -13,6 +13,8 @@
13
13
  "./package.json": "./package.json"
14
14
  },
15
15
  "scripts": {
16
+ "validate:consistency": "node --loader ts-node/esm scripts/validate-consistency.ts",
17
+ "prebuild": "npm run validate:consistency",
16
18
  "build": "tsc && npm run copy-templates",
17
19
  "build:prod": "npm run build && npm run remove-sourcemaps",
18
20
  "copy-templates": "copyfiles -u 1 \"src/templates/**/*\" dist/",
@@ -27,7 +29,7 @@
27
29
  "format": "prettier --write \"src/**/*.ts\"",
28
30
  "format:check": "prettier --check \"src/**/*.ts\"",
29
31
  "prepare": "husky",
30
- "prepublishOnly": "npm run build:prod"
32
+ "prepublishOnly": "npm run validate:consistency && npm run build:prod"
31
33
  },
32
34
  "repository": {
33
35
  "type": "git",