clavix 4.2.0 → 4.3.2

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.
Files changed (51) hide show
  1. package/LICENSE +201 -21
  2. package/README.md +1 -1
  3. package/dist/cli/commands/deep.js +4 -58
  4. package/dist/cli/commands/init.js +13 -16
  5. package/dist/cli/commands/plan.js +2 -2
  6. package/dist/core/conversation-quality-tracker.d.ts +81 -0
  7. package/dist/core/conversation-quality-tracker.js +195 -0
  8. package/dist/core/intelligence/intent-detector.js +3 -0
  9. package/dist/core/intelligence/pattern-library.d.ts +18 -1
  10. package/dist/core/intelligence/pattern-library.js +131 -0
  11. package/dist/core/intelligence/patterns/conversation-summarizer.d.ts +25 -0
  12. package/dist/core/intelligence/patterns/conversation-summarizer.js +197 -0
  13. package/dist/core/intelligence/patterns/dependency-identifier.d.ts +21 -0
  14. package/dist/core/intelligence/patterns/dependency-identifier.js +149 -0
  15. package/dist/core/intelligence/patterns/implicit-requirement-extractor.d.ts +20 -0
  16. package/dist/core/intelligence/patterns/implicit-requirement-extractor.js +129 -0
  17. package/dist/core/intelligence/patterns/requirement-prioritizer.d.ts +22 -0
  18. package/dist/core/intelligence/patterns/requirement-prioritizer.js +117 -0
  19. package/dist/core/intelligence/patterns/success-metrics-enforcer.d.ts +22 -0
  20. package/dist/core/intelligence/patterns/success-metrics-enforcer.js +142 -0
  21. package/dist/core/intelligence/patterns/topic-coherence-analyzer.d.ts +22 -0
  22. package/dist/core/intelligence/patterns/topic-coherence-analyzer.js +140 -0
  23. package/dist/core/intelligence/patterns/user-persona-enricher.d.ts +22 -0
  24. package/dist/core/intelligence/patterns/user-persona-enricher.js +124 -0
  25. package/dist/core/intelligence/quality-assessor.js +2 -0
  26. package/dist/core/intelligence/types.d.ts +7 -2
  27. package/dist/core/intelligence/universal-optimizer.d.ts +27 -2
  28. package/dist/core/intelligence/universal-optimizer.js +65 -5
  29. package/dist/core/task-manager.d.ts +1 -2
  30. package/dist/core/task-manager.js +21 -26
  31. package/dist/templates/slash-commands/_canonical/deep.md +37 -69
  32. package/dist/templates/slash-commands/_canonical/fast.md +1 -0
  33. package/dist/templates/slash-commands/_components/sections/pattern-visibility.md +26 -2
  34. package/package.json +3 -3
  35. package/dist/templates/instructions/README 2.md +0 -311
  36. package/dist/templates/instructions/core 2/clavix-mode.md +0 -275
  37. package/dist/templates/instructions/core 2/file-operations.md +0 -330
  38. package/dist/templates/instructions/core 2/verification.md +0 -377
  39. package/dist/templates/instructions/troubleshooting 2/jumped-to-implementation.md +0 -234
  40. package/dist/templates/instructions/troubleshooting 2/mode-confusion.md +0 -402
  41. package/dist/templates/instructions/troubleshooting 2/skipped-file-creation.md +0 -385
  42. package/dist/templates/slash-commands/_canonical 2/archive.md +0 -410
  43. package/dist/templates/slash-commands/_canonical 2/deep.md +0 -512
  44. package/dist/templates/slash-commands/_canonical 2/execute.md +0 -80
  45. package/dist/templates/slash-commands/_canonical 2/fast.md +0 -370
  46. package/dist/templates/slash-commands/_canonical 2/implement.md +0 -364
  47. package/dist/templates/slash-commands/_canonical 2/plan.md +0 -329
  48. package/dist/templates/slash-commands/_canonical 2/prd.md +0 -320
  49. package/dist/templates/slash-commands/_canonical 2/prompts.md +0 -97
  50. package/dist/templates/slash-commands/_canonical 2/start.md +0 -204
  51. package/dist/templates/slash-commands/_canonical 2/summarize.md +0 -395
@@ -93,6 +93,7 @@ Deep mode provides **Clavix Intelligence™** with comprehensive analysis that g
93
93
  - **migration**: Version upgrades, porting code between frameworks
94
94
  - **security-review**: Security audits, vulnerability checks
95
95
  - **learning**: Conceptual understanding, tutorials, explanations
96
+ - **summarization**: Extracting requirements from conversations
96
97
 
97
98
  3. **Strategic Scope Detection** (before detailed analysis):
98
99
 
@@ -131,18 +132,12 @@ Deep mode provides **Clavix Intelligence™** with comprehensive analysis that g
131
132
 
132
133
  d. **Improvements Applied** (labeled with quality dimensions)
133
134
 
134
- e. **Alternative Approaches**:
135
- - 2-3 different ways to phrase the request
136
- - Alternative structures (user story, job story, structured sections)
137
- - When each approach is most appropriate
138
- - Temperature/model recommendations
135
+ e. **Alternative Approaches** (generated by AlternativePhrasingGenerator pattern):
136
+ - 2-3 different ways to approach the request
137
+ - Each approach with title, description, and "best for" context
138
+ - Intent-specific alternatives (e.g., Functional Decomposition for code, Top-Down Design for planning)
139
139
 
140
- f. **Alternative Structures**:
141
- - **Step-by-step**: Break into sequential steps
142
- - **Template-based**: Provide code/document template to fill
143
- - **Example-driven**: Show concrete examples of desired output
144
-
145
- g. **Validation Checklist**:
140
+ f. **Validation Checklist** (generated by ValidationChecklistCreator pattern):
146
141
  - Steps to verify accuracy
147
142
  - Requirements match checks
148
143
  - Edge case handling verification
@@ -150,7 +145,7 @@ Deep mode provides **Clavix Intelligence™** with comprehensive analysis that g
150
145
  - Output format validation
151
146
  - Performance considerations
152
147
 
153
- h. **Edge Cases to Consider**:
148
+ g. **Edge Cases to Consider** (generated by EdgeCaseIdentifier pattern):
154
149
  - Intent-specific edge cases
155
150
  - Error conditions and recovery
156
151
  - Unexpected inputs or behavior
@@ -171,10 +166,9 @@ Deep mode provides **Clavix Intelligence™** with comprehensive analysis that g
171
166
  - **Intent Detection**: Automatic classification with confidence
172
167
  - **Quality Assessment**: All 6 dimensions with detailed analysis
173
168
  - **Advanced Optimization**: All applicable patterns
174
- - **Alternative Approaches**: Multiple phrasings and perspectives
175
- - **Alternative Structures**: Different organization approaches
176
- - **Validation Checklist**: Steps to verify completion
177
- - **Edge Case Analysis**: Potential issues and failure modes
169
+ - **Alternative Approaches**: Multiple approaches (generated by AlternativePhrasingGenerator pattern)
170
+ - **Validation Checklist**: Steps to verify completion (generated by ValidationChecklistCreator pattern)
171
+ - **Edge Case Analysis**: Potential issues and failure modes (generated by EdgeCaseIdentifier pattern)
178
172
  - **Risk Assessment**: "What could go wrong" analysis
179
173
 
180
174
  **Do NOT include (these belong in `/clavix:prd`):**
@@ -290,66 +284,40 @@ Success Criteria:
290
284
  [Completeness] Added tech stack (React/TypeScript), API endpoint, accessibility standards, testing requirements
291
285
  [Actionability] Converted vague request into specific, measurable implementation requirements
292
286
 
293
- ### Alternative Approaches:
287
+ ### Alternative Approaches
294
288
 
295
- 1. **Functional Decomposition**: "Build a React login component that: (1) validates email/password inputs, (2) calls JWT auth API, (3) handles errors gracefully, (4) manages session persistence"
289
+ **1. Functional Decomposition**
290
+ Break down into discrete functions with clear interfaces
296
291
  → Best for: Step-by-step implementation, clarity on sequence
297
292
 
298
- 2. **User-Centric**: "As a user, I need to log into my account securely using email/password, with clear feedback if credentials are invalid"
299
- Best for: Emphasizing user experience and value
300
-
301
- 3. **Example-Driven**: "Create a login page similar to [reference], with email/password fields, validation, and integration with our JWT API"
302
- → Best for: When you have a reference implementation
303
-
304
- ### Alternative Structures:
293
+ **2. Test-Driven Approach**
294
+ Define expected behavior through tests first
295
+ → Best for: When requirements are clear and testable
305
296
 
306
- **Step-by-step approach:**
307
- 1. Create form with email/password inputs and validation
308
- 2. Implement API integration with JWT endpoint
309
- 3. Add error handling and user feedback
310
- 4. Implement "remember me" and "forgot password" features
311
- 5. Add accessibility and responsive design
312
- 6. Write tests and documentation
297
+ **3. Example-Driven**
298
+ Provide concrete input/output examples
299
+ Best for: When you have reference implementations
313
300
 
314
- **Template-based approach:**
315
- Provide a component template with:
316
- - Form structure with input fields
317
- - Validation logic placeholders
318
- - API call hooks
319
- - Error state management
320
- - Accessibility attributes
321
-
322
- **Example-driven approach:**
323
- Show concrete examples of:
324
- - Login form HTML structure
325
- - Validation error messages
326
- - Success/failure API responses
327
- - Loading and error states
328
-
329
- ### Validation Checklist:
301
+ ### Validation Checklist
330
302
 
331
303
  Before considering this task complete, verify:
332
- ☐ Email and password fields validate input correctly
333
- Invalid credentials show appropriate, user-friendly error messages
334
- Successful login redirects to correct page or updates auth state
335
- "Remember me" persists session across browser sessions
336
- "Forgot password" link navigates to password reset flow
337
- Form is keyboard accessible (tab navigation, enter to submit)
338
- Screen readers announce errors and state changes
339
- Loading state prevents duplicate submissions
340
- Component renders correctly on mobile and desktop
341
- ☐ Unit tests cover success, failure, and edge cases (>80% coverage)
342
-
343
- ### Edge Cases to Consider:
344
-
345
- • **Empty or invalid inputs**: How to handle blank email, malformed email, empty password?
346
- • **API failures**: What happens if auth API is down or times out?
347
- • **Slow network**: How to indicate loading state and prevent double-submission?
348
- • **Expired sessions**: How to handle JWT expiration during login attempt?
349
- • **Account locked**: What if user account is temporarily locked after failed attempts?
350
- • **Password reset in progress**: How to handle user who requested reset but tries to login?
351
- • **Browser autofill**: Does component work correctly with password managers?
352
- • **Concurrent logins**: What happens if user logs in on multiple devices?
304
+
305
+ Code compiles/runs without errors
306
+ All requirements from prompt are implemented
307
+ Edge cases are handled gracefully
308
+ UI renders correctly on different screen sizes
309
+ Keyboard navigation works correctly
310
+ Code follows project conventions/style guide
311
+ No console errors or warnings
312
+ Documentation updated if needed
313
+
314
+ ### Edge Cases to Consider
315
+
316
+ • **Boundary conditions**: What happens at min/max values, empty collections, or single items?
317
+ • **Empty or null inputs**: How should the system handle missing or undefined values?
318
+ • **Invalid input types**: What happens if input is wrong type (string vs number)?
319
+ • **Network failures**: How to handle timeouts, connection errors, and retries?
320
+ • **Session expiration**: What happens when user session expires mid-operation?
353
321
 
354
322
  ### What Could Go Wrong:
355
323
 
@@ -91,6 +91,7 @@ Clavix provides **Clavix Intelligence™** that automatically detects intent and
91
91
  - **migration**: Version upgrades, porting code between frameworks
92
92
  - **security-review**: Security audits, vulnerability checks
93
93
  - **learning**: Conceptual understanding, tutorials, explanations
94
+ - **summarization**: Extracting requirements from conversations
94
95
 
95
96
  3. **Quality Assessment** - Evaluate across 6 dimensions:
96
97
 
@@ -75,6 +75,21 @@ Patterns: 7 applied (deep mode)
75
75
  | SuccessCriteriaEnforcer | 6 | Adds measurable success criteria |
76
76
  | DomainContextEnricher | 5 | Adds domain-specific best practices |
77
77
 
78
+ **v4.3.2 PRD Mode Patterns (deep mode):**
79
+ | Pattern | Priority | What It Does |
80
+ |---------|----------|--------------|
81
+ | RequirementPrioritizer | 7 | Separates must-have from nice-to-have requirements |
82
+ | UserPersonaEnricher | 6 | Adds missing user context and personas |
83
+ | SuccessMetricsEnforcer | 7 | Ensures measurable success criteria exist |
84
+ | DependencyIdentifier | 5 | Identifies technical and external dependencies |
85
+
86
+ **v4.3.2 Conversational Mode Patterns (deep mode):**
87
+ | Pattern | Priority | What It Does |
88
+ |---------|----------|--------------|
89
+ | ConversationSummarizer | 8 | Extracts structured requirements from messages |
90
+ | TopicCoherenceAnalyzer | 6 | Detects topic shifts and multi-topic conversations |
91
+ | ImplicitRequirementExtractor | 7 | Surfaces requirements mentioned indirectly |
92
+
78
93
  ### Pattern Selection Logic
79
94
 
80
95
  Patterns are selected based on:
@@ -109,11 +124,20 @@ Deep mode only:
109
124
  AlternativePhrasingGenerator, EdgeCaseIdentifier, ValidationChecklistCreator,
110
125
  AssumptionExplicitizer, ScopeDefiner, PRDStructureEnforcer,
111
126
  ErrorToleranceEnhancer, PrerequisiteIdentifier
127
+
128
+ v4.3.2 PRD mode (deep):
129
+ RequirementPrioritizer, UserPersonaEnricher, SuccessMetricsEnforcer,
130
+ DependencyIdentifier
131
+
132
+ v4.3.2 Conversational mode (deep):
133
+ ConversationSummarizer, TopicCoherenceAnalyzer, ImplicitRequirementExtractor
112
134
  ```
113
135
 
114
136
  ### Pattern Count by Mode
115
137
 
116
138
  | Mode | Patterns Available | Typical Applied |
117
139
  |------|-------------------|-----------------|
118
- | Fast | 12 core patterns | 4-7 patterns |
119
- | Deep | 20 total patterns | 8-14 patterns |
140
+ | Fast | 21 core patterns | 4-7 patterns |
141
+ | Deep | 27 total patterns | 8-14 patterns |
142
+ | PRD | 15 patterns | 10-15 patterns |
143
+ | Conversational | 11 patterns | 6-11 patterns |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavix",
3
- "version": "4.2.0",
3
+ "version": "4.3.2",
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",
@@ -17,7 +17,7 @@
17
17
  "prebuild": "npm run validate:consistency",
18
18
  "build": "tsc && npm run copy-templates",
19
19
  "build:prod": "npm run build && npm run remove-sourcemaps",
20
- "copy-templates": "copyfiles -u 1 \"src/templates/**/*\" dist/",
20
+ "copy-templates": "rm -rf dist/templates && copyfiles -u 1 \"src/templates/**/*\" dist/",
21
21
  "remove-sourcemaps": "find dist -name '*.map' -type f -delete",
22
22
  "dev": "node --loader ts-node/esm src/index.ts",
23
23
  "test": "NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" jest",
@@ -54,7 +54,7 @@
54
54
  "requirements"
55
55
  ],
56
56
  "author": "ClavixDev",
57
- "license": "MIT",
57
+ "license": "Apache-2.0",
58
58
  "bugs": {
59
59
  "url": "https://github.com/ClavixDev/Clavix/issues"
60
60
  },
@@ -1,311 +0,0 @@
1
- # Clavix Instructions Hierarchy
2
-
3
- This directory contains the complete instruction set for AI agents consuming Clavix workflows. Understanding this hierarchy is critical for maintaining consistent, high-quality agent behavior.
4
-
5
- ---
6
-
7
- ## 📐 Documentation Architecture
8
-
9
- ```
10
- Canonical Templates (SOURCE OF TRUTH)
11
- src/templates/slash-commands/_canonical/
12
- ├── fast.md, deep.md, prd.md
13
- ├── start.md, summarize.md
14
- ├── plan.md, implement.md, execute.md
15
- └── archive.md, prompts.md
16
- ↓ (copied during clavix init)
17
- Instruction Files (AUTO-GENERATED)
18
- .clavix/instructions/
19
- ├── workflows/ - Complete workflows (COPIED from canonical)
20
- ├── core/ - Foundational concepts (static)
21
- └── troubleshooting/ - Common issues (static)
22
- ↓ (reference)
23
- Generic Connectors (THIN WRAPPERS)
24
- src/templates/agents/
25
- ├── agents.md - Generic agents
26
- ├── octo.md - Octofriend-specific
27
- ├── copilot-instructions.md - GitHub Copilot
28
- └── warp.md - Warp AI
29
- ```
30
-
31
- ---
32
-
33
- ## 🎯 Core Principles
34
-
35
- ### 1. Single Source of Truth
36
-
37
- **Canonical templates** (`src/templates/slash-commands/_canonical/`) are the definitive reference:
38
- - Complete workflow descriptions
39
- - Official command behavior
40
- - Authoritative patterns and examples
41
- - NEVER modified for size/brevity - they define the standard
42
-
43
- **Rule:** When canonical and instruction files conflict, canonical wins.
44
-
45
- ### 2. Agent-Optimized Instructions
46
-
47
- **Instruction files** (`src/templates/instructions/`) are derived from canonical templates but optimized for AI agent consumption:
48
- - Must match canonical workflows 100% in substance
49
- - Can reorganize for better agent comprehension
50
- - Add explicit checkpoints, self-correction checks, troubleshooting
51
- - Include "Common Mistakes" sections with wrong/right examples
52
- - Expand on ambiguous points from canonical
53
-
54
- **Rule:** Instruction files implement canonical, never contradict it.
55
-
56
- ### 3. Thin Generic Connectors
57
-
58
- **Generic connector files** (`src/templates/agents/`) are minimal wrappers:
59
- - Reference instruction files, don't duplicate them
60
- - Platform-specific guidance ONLY (model switching, tool limitations, etc.)
61
- - Brief workflow overview + standard workflow (PRD → Plan → Implement → Archive)
62
- - Command quick reference table
63
- - Common mistakes specific to platform
64
-
65
- **Target sizes:**
66
- - agents.md: 4-7K (generic, no platform features)
67
- - octo.md: 7-10K (Octofriend has unique features)
68
- - copilot-instructions.md: 5-7K (GitHub Copilot integration)
69
- - warp.md: 5-7K (Warp AI-specific)
70
-
71
- **Rule:** If it's in an instruction file, don't duplicate it in a connector file.
72
-
73
- ---
74
-
75
- ## 📂 Directory Structure
76
-
77
- ### `/workflows/` - Step-by-Step Workflows
78
-
79
- Complete, executable workflows with explicit steps:
80
-
81
- | File | Purpose | Key Sections |
82
- |------|---------|--------------|
83
- | `start.md` | Conversational mode entry | Questions, complexity tracking, mode transitions |
84
- | `summarize.md` | Extract requirements from conversation | Pre-validation, extraction, file creation, optimization |
85
- | `fast.md` | Quick prompt optimization | Intent detection, quality assessment, smart triage |
86
- | `deep.md` | Comprehensive analysis | Strategic scope, alternatives, validation, edge cases, risks |
87
- | `prd.md` | PRD generation via Socratic questions | 5-question sequence, validation criteria, file-saving protocol |
88
-
89
- **Pattern:** Each workflow file includes:
90
- - CLAVIX PLANNING MODE block (clarifies planning vs implementation)
91
- - Complete workflow steps with checkpoints
92
- - Self-correction checks
93
- - Common mistakes (wrong/right examples)
94
- - Troubleshooting references
95
- - Integration with other workflows
96
-
97
- ### `/core/` - Foundational Concepts
98
-
99
- Cross-workflow patterns and principles:
100
-
101
- | File | Purpose | Key Content |
102
- |------|---------|-------------|
103
- | `clavix-mode.md` | Planning vs implementation distinction | Mode table, standard workflow, command categorization |
104
- | `file-operations.md` | File creation patterns | Write tool usage, verification steps, error handling |
105
- | `verification.md` | Checkpoint patterns | Self-correction triggers, validation approaches |
106
-
107
- **Purpose:** Define concepts used across multiple workflows to avoid duplication.
108
-
109
- ### `/troubleshooting/` - Common Issues
110
-
111
- Problem → Solution guides:
112
-
113
- | File | Purpose | Symptoms & Solutions |
114
- |------|---------|---------------------|
115
- | `jumped-to-implementation.md` | Agent implemented during planning | Detect, stop, apologize, return to planning |
116
- | `skipped-file-creation.md` | Files not created | Explicit Write tool steps, verification protocol |
117
- | `mode-confusion.md` | Unclear planning vs implementation | Ask user to clarify, explain mode boundaries |
118
-
119
- **Pattern:** Each troubleshooting file includes:
120
- - Symptoms (how to detect the problem)
121
- - Root cause (why it happened)
122
- - Solution (step-by-step fix)
123
- - Prevention (how to avoid in future)
124
-
125
- ---
126
-
127
- ## 🔄 Maintenance Workflow
128
-
129
- ### When Adding New Workflow
130
-
131
- 1. **Create canonical template** in `src/templates/slash-commands/_canonical/`
132
- - Complete workflow description
133
- - All steps, examples, edge cases
134
- - This is the official reference
135
-
136
- 2. **NO NEED to create instruction file** - It's auto-copied during init
137
- - During `clavix init`, canonical templates are automatically copied to `.clavix/instructions/workflows/`
138
- - User projects get fresh copy on init/update
139
- - **Single source of truth:** Only maintain canonical template
140
-
141
- 3. **Update generic connectors** in `src/templates/agents/` (if needed)
142
- - Add table reference to new workflow
143
- - Update workflow detection keywords
144
- - DO NOT duplicate workflow steps
145
-
146
- 4. **Update this README** if new pattern/principle introduced
147
-
148
- ### When Modifying Existing Workflow
149
-
150
- 1. **Update canonical template** - This is source of truth
151
- 2. **Users run `clavix update`** - Refreshes `.clavix/instructions/workflows/` from canonical
152
- 3. **Test:** Verify `clavix update` propagates changes correctly
153
- 4. **No manual duplication needed** - InstructionsGenerator copies from canonical automatically
154
-
155
- ### When Reporting Verbosity Issues
156
-
157
- **Bloat checklist:**
158
- 1. Is canonical template duplicated in instruction file? → Remove from instruction, reference canonical
159
- 2. Is instruction file duplicated in connector file? → Remove from connector, reference instruction
160
- 3. Is workflow description inline in connector? → Remove, add table reference to instruction file
161
- 4. Are "Common Mistakes" duplicated across files? → Keep in instruction file only
162
- 5. Is command reference table too detailed? → Condense to single-line purpose
163
-
164
- **Size targets:**
165
- - Canonical templates: 10-20K (complete reference, no size limit)
166
- - Instruction files: 10-18K (agent-optimized, comprehensive)
167
- - Generic connectors: 4-10K (thin wrappers)
168
-
169
- ---
170
-
171
- ## 🧠 Design Philosophy
172
-
173
- ### Why Three Layers?
174
-
175
- **Layer 1: Canonical Templates**
176
- - **Audience:** CLI implementation, human developers, official documentation
177
- - **Purpose:** Define authoritative behavior
178
- - **Constraint:** Complete and accurate, no brevity requirement
179
-
180
- **Layer 2: Instruction Files**
181
- - **Audience:** AI agents (all platforms)
182
- - **Purpose:** Executable guidance with self-correction
183
- - **Constraint:** Must match canonical, optimized for agent comprehension
184
-
185
- **Layer 3: Generic Connectors**
186
- - **Audience:** Platform-specific agents (Copilot, Octofriend, Warp, generic)
187
- - **Purpose:** Minimal platform-specific wrapper + references
188
- - **Constraint:** Keep thin, reference instruction files, platform-unique guidance only
189
-
190
- ### Why Not Just One File?
191
-
192
- **Problems with single-file approach:**
193
- 1. **Duplication:** Same workflow described 4+ times (canonical + 3 platforms)
194
- 2. **Maintenance burden:** Update one workflow = edit 4+ files
195
- 3. **Size bloat:** Each platform file becomes 15-20K
196
- 4. **Inconsistency:** Descriptions drift apart over time
197
- 5. **Confusion:** Agent sees multiple versions, unclear which is authoritative
198
-
199
- **Benefits of three-layer hierarchy:**
200
- 1. **DRY principle:** Write workflow once (instruction file), reference everywhere
201
- 2. **Single source of truth:** Canonical → Instruction → Connector flow
202
- 3. **Platform focus:** Connector files focus on platform-specific value (model switching, tool limitations)
203
- 4. **Maintainability:** Fix bug in one instruction file, all platforms benefit
204
- 5. **Clarity:** Agent knows where to look - instruction file for workflow, connector for platform quirks
205
-
206
- ---
207
-
208
- ## 📋 Quick Reference Tables
209
-
210
- ### Standard Workflow
211
-
212
- All workflows follow this progression:
213
-
214
- ```
215
- PRD Creation → Task Planning → Implementation → Archive
216
- ```
217
-
218
- | Phase | Command | Output | Mode |
219
- |-------|---------|--------|------|
220
- | **Planning** | `clavix prd` or conversational | `full-prd.md` + `quick-prd.md` | PLANNING |
221
- | **Task Prep** | `clavix plan` | `tasks.md` | PLANNING (Pre-Implementation) |
222
- | **Implementation** | `clavix implement` | Executed code | IMPLEMENTATION |
223
- | **Completion** | `clavix archive` | Archived project | Management |
224
-
225
- ### Mode Distinction
226
-
227
- | Command | Mode | Implement? |
228
- |---------|------|------------|
229
- | `/clavix:start` | Planning | ✗ NO |
230
- | `/clavix:summarize` | Planning | ✗ NO |
231
- | `/clavix:fast` | Planning | ✗ NO |
232
- | `/clavix:deep` | Planning | ✗ NO |
233
- | `/clavix:prd` | Planning | ✗ NO |
234
- | `/clavix:plan` | Planning (Pre-Implementation) | ✗ NO |
235
- | `/clavix:implement` | Implementation | ✓ YES |
236
- | `/clavix:execute` | Implementation | ✓ YES |
237
- | `/clavix:task-complete` | Implementation | ✓ YES |
238
-
239
- ### File Size Expectations
240
-
241
- | File Type | Size Range | Line Range | Purpose |
242
- |-----------|-----------|------------|---------|
243
- | Canonical Template | 10-20K | 300-600 lines | Complete reference (no limit) |
244
- | Instruction File | 10-18K | 350-650 lines | Agent-executable workflows |
245
- | Generic Connector | 4-10K | 150-300 lines | Thin wrapper + platform-specific |
246
-
247
- ---
248
-
249
- ## 🔧 Troubleshooting
250
-
251
- ### "Agent jumped to implementation during planning"
252
-
253
- **Root cause:** Agent didn't recognize planning mode boundary
254
-
255
- **Fix:**
256
- 1. Check instruction file has CLAVIX PLANNING MODE block at top
257
- 2. Verify "DO NOT IMPLEMENT" warnings present and clear
258
- 3. Add self-correction check: "Check 1: Am I Implementing?"
259
- 4. Reference `troubleshooting/jumped-to-implementation.md`
260
-
261
- ### "Agent skipped file creation"
262
-
263
- **Root cause:** File-saving protocol not explicit enough
264
-
265
- **Fix:**
266
- 1. Add explicit step-by-step file creation section
267
- 2. Include "Step N: Verify Files Were Created" with ls command
268
- 3. Add common mistake: "Skipping file creation"
269
- 4. Reference `troubleshooting/skipped-file-creation.md`
270
-
271
- ### "Generic connector file too large (>10K)"
272
-
273
- **Root cause:** Duplicating instruction file content
274
-
275
- **Fix:**
276
- 1. Identify duplicated workflow descriptions
277
- 2. Replace with table reference to instruction file
278
- 3. Keep only platform-specific guidance (model switching, tool limitations, etc.)
279
- 4. Condense CLI reference table (one line per command)
280
- 5. Remove detailed workflow explanations (link to instruction file instead)
281
-
282
- ### "Instruction file doesn't match canonical"
283
-
284
- **Root cause:** Manual edit to instruction file without checking canonical
285
-
286
- **Fix:**
287
- 1. Read canonical template: `src/templates/slash-commands/_canonical/<workflow>.md`
288
- 2. Compare with instruction file: `src/templates/instructions/workflows/<workflow>.md`
289
- 3. Ensure substance matches 100%
290
- 4. Reorganization for agent clarity is OK, contradicting canonical is NOT
291
-
292
- ---
293
-
294
- ## 📚 Additional Resources
295
-
296
- **Related documentation:**
297
- - `src/templates/slash-commands/_canonical/README.md` - Canonical template guidelines
298
- - `src/templates/agents/README.md` - Generic connector patterns (if exists)
299
- - `CONTRIBUTING.md` - General contribution guidelines
300
- - `ARCHITECTURE.md` - Overall Clavix architecture
301
-
302
- **Key files to read first:**
303
- - `core/clavix-mode.md` - Understand planning vs implementation
304
- - `workflows/fast.md` - See complete workflow pattern
305
- - `../agents/octo.md` - See thin connector example (post-v3.6.1)
306
-
307
- ---
308
-
309
- **Last updated:** v3.6.1 (November 2025)
310
-
311
- **Maintainers:** Ensure this README stays synchronized with actual instruction hierarchy.