clavix 4.8.1 → 4.10.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.
Files changed (25) hide show
  1. package/dist/cli/commands/analyze.d.ts +14 -0
  2. package/dist/cli/commands/analyze.js +127 -0
  3. package/dist/templates/slash-commands/_canonical/archive.md +67 -81
  4. package/dist/templates/slash-commands/_canonical/deep.md +88 -47
  5. package/dist/templates/slash-commands/_canonical/execute.md +200 -155
  6. package/dist/templates/slash-commands/_canonical/fast.md +78 -37
  7. package/dist/templates/slash-commands/_canonical/implement.md +310 -300
  8. package/dist/templates/slash-commands/_canonical/plan.md +33 -17
  9. package/dist/templates/slash-commands/_canonical/prd.md +36 -21
  10. package/dist/templates/slash-commands/_canonical/start.md +34 -33
  11. package/dist/templates/slash-commands/_canonical/summarize.md +39 -47
  12. package/dist/templates/slash-commands/_canonical/verify.md +324 -186
  13. package/dist/templates/slash-commands/_components/agent-protocols/cli-reference.md +214 -0
  14. package/dist/templates/slash-commands/_components/agent-protocols/error-handling.md +145 -88
  15. package/dist/templates/slash-commands/_components/agent-protocols/self-correction.md +20 -1
  16. package/dist/templates/slash-commands/_components/agent-protocols/supportive-companion.md +216 -0
  17. package/dist/templates/slash-commands/_components/agent-protocols/task-blocking.md +224 -0
  18. package/dist/templates/slash-commands/_components/references/quality-dimensions.md +152 -44
  19. package/dist/templates/slash-commands/_components/sections/conversation-examples.md +302 -0
  20. package/dist/templates/slash-commands/_components/sections/escalation-factors.md +119 -87
  21. package/dist/templates/slash-commands/_components/sections/improvement-explanations.md +171 -0
  22. package/dist/templates/slash-commands/_components/sections/pattern-impact.md +208 -0
  23. package/dist/templates/slash-commands/_components/sections/prd-examples.md +289 -0
  24. package/dist/templates/slash-commands/_components/troubleshooting/vibecoder-recovery.md +223 -0
  25. package/package.json +1 -1
@@ -0,0 +1,214 @@
1
+ ## CLI Commands Reference (For Agent Execution)
2
+
3
+ These are commands YOU (the agent) run automatically. Never ask the user to run these - you execute them and report results.
4
+
5
+ ---
6
+
7
+ ### Prompt Management Commands
8
+
9
+ #### `clavix fast "prompt"`
10
+ **What it does:** Quickly improves a prompt and saves it
11
+ **When to run:** After user provides a prompt for optimization
12
+ **You say:** "Let me improve this prompt for you..."
13
+ **Example:**
14
+ ```bash
15
+ clavix fast "build a todo app"
16
+ ```
17
+
18
+ #### `clavix deep "prompt"`
19
+ **What it does:** Comprehensive prompt analysis with alternatives and edge cases
20
+ **When to run:** When prompt needs thorough analysis (complex requirements, low quality score)
21
+ **You say:** "This needs a deeper look - let me analyze it thoroughly..."
22
+ **Example:**
23
+ ```bash
24
+ clavix deep "create authentication system with OAuth"
25
+ ```
26
+
27
+ #### `clavix analyze "prompt"`
28
+ **What it does:** Returns structured JSON with intent, quality scores, and escalation recommendation
29
+ **When to run:** When you need data-driven decision on which mode to use
30
+ **You say:** Nothing - this is for internal decision-making
31
+ **Example:**
32
+ ```bash
33
+ clavix analyze "build a login page"
34
+ ```
35
+ **Output:** JSON with `intent`, `confidence`, `quality` (6 dimensions), `escalation` (score + recommendation)
36
+ **Flags:**
37
+ - `--pretty` - Pretty-print the JSON output
38
+
39
+ #### `clavix prompts list`
40
+ **What it does:** Shows all saved prompts with their status
41
+ **When to run:** To verify a prompt was saved, or find prompt IDs
42
+ **You say:** "Let me check your saved prompts..."
43
+ **Example output:**
44
+ ```
45
+ 📋 Saved Prompts (3 total)
46
+ fast-20250126-143022-a3f2 [not executed] "build a todo app..."
47
+ deep-20250126-150000-b4c3 [executed] "authentication system..."
48
+ ```
49
+
50
+ #### `clavix prompts clear --executed`
51
+ **What it does:** Removes prompts that have already been implemented
52
+ **When to run:** During cleanup or when user wants to tidy up
53
+ **You say:** "Cleaning up executed prompts..."
54
+
55
+ #### `clavix prompts clear --stale`
56
+ **What it does:** Removes prompts older than 30 days
57
+ **When to run:** When storage is cluttered with old prompts
58
+ **You say:** "Removing old prompts to keep things tidy..."
59
+
60
+ ---
61
+
62
+ ### Implementation Commands
63
+
64
+ #### `clavix execute --latest`
65
+ **What it does:** Retrieves the most recent saved prompt for implementation
66
+ **When to run:** When starting implementation workflow
67
+ **You say:** "Getting your latest prompt ready for implementation..."
68
+ **Flags:**
69
+ - `--latest` - Get most recent prompt
70
+ - `--fast` - Filter to fast prompts only
71
+ - `--deep` - Filter to deep prompts only
72
+ - `--id <prompt-id>` - Get specific prompt
73
+
74
+ #### `clavix implement`
75
+ **What it does:** Starts implementation session from task plan
76
+ **When to run:** After PRD and tasks exist, ready to build
77
+ **You say:** "Starting implementation - let me check your tasks..."
78
+ **Flags:**
79
+ - `--commit-strategy=per-task` - Commit after each task
80
+ - `--commit-strategy=per-phase` - Commit after each phase
81
+ - `--list` - Show available tasks
82
+
83
+ #### `clavix task-complete <task-id>`
84
+ **What it does:** Marks a task as done, updates tracking, optionally commits
85
+ **When to run:** IMMEDIATELY after finishing each task implementation
86
+ **You say:** "Marking that task as complete..."
87
+ **CRITICAL:** Never manually edit tasks.md checkboxes - always use this command
88
+ **Example:**
89
+ ```bash
90
+ clavix task-complete phase-1-setup-project-1
91
+ ```
92
+ **Flags:**
93
+ - `--no-git` - Skip git commit
94
+ - `--force` - Complete even if already done
95
+
96
+ #### `clavix verify --latest`
97
+ **What it does:** Runs verification checks against implementation
98
+ **When to run:** After implementation, before considering work done
99
+ **You say:** "Running verification checks..."
100
+ **Flags:**
101
+ - `--latest` - Verify most recent executed prompt
102
+ - `--id <prompt-id>` - Verify specific prompt
103
+ - `--status` - Show verification status only
104
+ - `--retry-failed` - Re-run only failed checks
105
+ - `--export markdown` - Generate verification report
106
+ - `--run-hooks` - Run automated tests (default: true)
107
+
108
+ ---
109
+
110
+ ### Planning Commands
111
+
112
+ #### `clavix prd`
113
+ **What it does:** Launches PRD generation workflow
114
+ **When to run:** When user wants to plan a feature/project
115
+ **You say:** "Let's plan this out properly..."
116
+
117
+ #### `clavix plan`
118
+ **What it does:** Generates task breakdown from PRD
119
+ **When to run:** After PRD exists, ready to create tasks
120
+ **You say:** "Creating your implementation tasks..."
121
+ **Flags:**
122
+ - `--project <name>` - Specify which project
123
+ - `--overwrite` - Regenerate existing tasks
124
+
125
+ ---
126
+
127
+ ### Project Management Commands
128
+
129
+ #### `clavix archive <project-name>`
130
+ **What it does:** Archives completed project
131
+ **When to run:** When all tasks are done and verified
132
+ **You say:** "Archiving this project for your records..."
133
+ **Flags:**
134
+ - `--force` - Archive even if incomplete
135
+ - `--delete` - Permanently delete instead
136
+ - `--list` - Show archived projects
137
+ - `--restore <name>` - Restore from archive
138
+
139
+ #### `clavix list`
140
+ **What it does:** Shows sessions and outputs
141
+ **When to run:** To find projects, check progress
142
+ **You say:** "Let me show you what we have..."
143
+ **Flags:**
144
+ - `--sessions` - List only sessions
145
+ - `--outputs` - List only outputs
146
+ - `--archived` - Include archived
147
+ - `--project <name>` - Filter by project
148
+
149
+ #### `clavix show --output <project>`
150
+ **What it does:** Shows detailed project information
151
+ **When to run:** When user asks about a specific project
152
+ **You say:** "Here's what's in that project..."
153
+
154
+ ---
155
+
156
+ ### Setup & Configuration Commands
157
+
158
+ #### `clavix init`
159
+ **What it does:** Sets up Clavix in current project
160
+ **When to run:** First time using Clavix in a project
161
+ **You say:** "Setting up Clavix for this project..."
162
+ **Features:**
163
+ - Auto-detects tech stack
164
+ - Configures integrations
165
+ - Creates .clavix/ directory
166
+
167
+ #### `clavix config get <key>`
168
+ **What it does:** Gets a configuration value
169
+ **When to run:** To check current settings
170
+ **Example:** `clavix config get preferences.verboseLogging`
171
+
172
+ #### `clavix config set <key> <value>`
173
+ **What it does:** Updates a configuration value
174
+ **When to run:** When user wants to change settings
175
+ **You say:** "Updating that setting..."
176
+
177
+ #### `clavix update`
178
+ **What it does:** Updates slash commands and documentation
179
+ **When to run:** After Clavix version update
180
+ **You say:** "Updating your Clavix setup..."
181
+ **Flags:**
182
+ - `--docs-only` - Update only documentation
183
+ - `--commands-only` - Update only slash commands
184
+
185
+ #### `clavix version`
186
+ **What it does:** Shows current Clavix version
187
+ **When to run:** To check version, troubleshoot issues
188
+ **Example output:** `Clavix v4.9.0`
189
+
190
+ ---
191
+
192
+ ### Agent Execution Protocol
193
+
194
+ **ALWAYS:**
195
+ 1. Run commands silently (don't show raw command to user)
196
+ 2. Report results in friendly language
197
+ 3. Handle errors gracefully (see error-handling.md)
198
+ 4. Continue workflow after successful commands
199
+
200
+ **NEVER:**
201
+ 1. Ask user to run terminal commands
202
+ 2. Show raw CLI output without explanation
203
+ 3. Skip verification after implementation
204
+ 4. Manually edit files that commands should update
205
+
206
+ **Example Flow:**
207
+ ```
208
+ User: "I'm done with task 1"
209
+
210
+ Agent (internally runs): clavix task-complete phase-1-setup-1
211
+ Agent (says to user): "Great! I've marked that task complete.
212
+ You're now 1/5 tasks done.
213
+ Ready to start the next one?"
214
+ ```
@@ -1,120 +1,177 @@
1
- ## Error Classification for Agents
1
+ ## Handling Problems Gracefully
2
2
 
3
- Errors are classified into three categories based on required agent response.
3
+ When something goes wrong, fix it yourself when possible. When you can't, explain simply and offer options.
4
4
 
5
- ### RECOVERABLE Errors
5
+ ---
6
6
 
7
- Agent can fix automatically without user intervention.
7
+ ### Three Types of Problems
8
8
 
9
- | Error | Detection | Recovery Action |
10
- |-------|-----------|-----------------|
11
- | Directory missing | ENOENT on .clavix/ | Create directory, continue |
12
- | Index file missing | ENOENT on .index.json | Initialize empty index, continue |
13
- | Empty prompts directory | No files in prompts/ | Inform user "No prompts saved yet" |
14
- | Stale config | timestamp > 7 days | Warn user, continue normally |
15
- | Missing session | Session ID not found | Create new session |
9
+ #### 1. Small Hiccups (Fix Yourself)
16
10
 
17
- **Recovery Protocol:**
18
- ```
19
- IF error is RECOVERABLE:
20
- → FIX: Apply recovery action automatically
21
- → LOG: Note what was fixed
22
- → CONTINUE: Resume workflow
23
- ```
11
+ These are minor issues you can handle automatically. Fix them and move on - no need to bother the user.
24
12
 
25
- ### BLOCKING Errors
13
+ | What Happened | What You Do | What You Say |
14
+ |---------------|-------------|--------------|
15
+ | Folder doesn't exist | Create it | "Setting things up..." (or nothing) |
16
+ | Index file missing | Create empty one | (Nothing - just continue) |
17
+ | No saved prompts yet | Normal state | "No prompts saved yet - let's create one!" |
18
+ | Old settings file | Still works | (Nothing - use it anyway) |
19
+ | Session not found | Start new one | (Nothing - create new) |
26
20
 
27
- Agent must stop and ask user before proceeding.
21
+ **Your approach:**
22
+ 1. Fix the issue automatically
23
+ 2. Maybe mention it briefly: "Setting things up..."
24
+ 3. Continue with what you were doing
28
25
 
29
- | Error | Detection | Agent Action |
30
- |-------|-----------|--------------|
31
- | Task not found | task-complete returns "not found" | ASK: "Task [id] not found in tasks.md. Verify the task ID?" |
32
- | Multiple PRDs | >1 project detected | ASK: "Multiple projects found: [list]. Which one?" |
33
- | Ambiguous intent | confidence <50% | ASK: "Unclear intent. Is this: [A] / [B] / [C]?" |
34
- | Missing PRD for plan | No PRD files exist | ASK: "No PRD found. Create one with /clavix:prd first?" |
35
- | Task blocked | External dependency | ASK: "Task blocked by [reason]. Skip or resolve?" |
36
- | Overwrite conflict | File already exists | ASK: "File exists. Overwrite / Rename / Cancel?" |
26
+ ---
37
27
 
38
- **Blocking Protocol:**
39
- ```
40
- IF error is BLOCKING:
41
- → STOP: Halt current operation
42
- → EXPLAIN: Clear description of the issue
43
- → OPTIONS: Present available choices
44
- → WAIT: For user response before continuing
45
- ```
28
+ #### 2. Need User Input (Ask Nicely)
46
29
 
47
- ### UNRECOVERABLE Errors
30
+ These need a decision from the user. Stop, explain simply, and offer clear choices.
48
31
 
49
- Agent must stop completely and report to user for manual resolution.
32
+ | What Happened | What You Ask |
33
+ |---------------|--------------|
34
+ | Can't find that task | "I can't find task [X]. Let me show you what's available..." |
35
+ | Multiple projects found | "I found a few projects here. Which one should we work on?" |
36
+ | Not sure what you want | "I want to make sure I understand - is this about [A] or [B]?" |
37
+ | No plan exists yet | "I don't see a plan for this project. Want to create one first?" |
38
+ | Task is blocked | "This task needs [thing] first. Should I work on that, or skip for now?" |
39
+ | File already exists | "This file already exists. Should I replace it, rename the new one, or cancel?" |
50
40
 
51
- | Error | Detection | Agent Action |
52
- |-------|-----------|--------------|
53
- | Permission denied | EACCES error code | STOP. Report: "Permission denied on [path]. Check file permissions." |
54
- | Corrupt JSON | JSON.parse throws | STOP. Report: "Config file corrupted at [path]. Manual fix required." |
55
- | Git conflict | git command fails with conflict | STOP. Report: "Git conflict detected. Resolve manually before continuing." |
56
- | Disk full | ENOSPC error | STOP. Report: "Disk full. Free up space before continuing." |
57
- | Network timeout | ETIMEDOUT on external | STOP. Report: "Network timeout. Check connection and retry." |
58
- | Invalid task ID format | Regex mismatch | STOP. Report: "Invalid task ID format: [id]. Expected: phase-N-name-M" |
41
+ **Your approach:**
42
+ 1. Stop what you're doing
43
+ 2. Explain the situation simply
44
+ 3. Give 2-3 clear options
45
+ 4. Wait for their answer
59
46
 
60
- **Unrecoverable Protocol:**
61
- ```
62
- IF error is UNRECOVERABLE:
63
- STOP: Halt all operations immediately
64
- REPORT: Exact error with context
65
- → GUIDE: Manual steps to resolve
66
- NO RETRY: Do not attempt automatic recovery
67
- ```
47
+ **Example:**
48
+ > "I found a few projects in this folder:
49
+ >
50
+ > 1. **todo-app** - 3 tasks done, 2 to go
51
+ > 2. **auth-feature** - Not started yet
52
+ >
53
+ > Which one should we work on?"
54
+
55
+ ---
56
+
57
+ #### 3. Real Problems (Need Their Help)
58
+
59
+ These are issues you can't fix. Stop completely and explain what they need to do.
60
+
61
+ | What Happened | What You Say |
62
+ |---------------|--------------|
63
+ | Permission denied | "I can't write to that folder - it looks like a permissions issue. You might need to check the folder settings." |
64
+ | Config file broken | "One of the settings files got corrupted. You might need to delete it and start fresh, or try to fix it manually." |
65
+ | Git conflict | "There's a git conflict that needs your attention. Once you resolve it, we can continue." |
66
+ | Disk full | "Looks like the disk is full - I can't save anything. Once you free up some space, we can try again." |
67
+ | Connection timeout | "I'm having trouble connecting. Could be a network issue - want to try again?" |
68
+ | Invalid format | "That doesn't look quite right - [specific issue]. Could you check and try again?" |
69
+
70
+ **Your approach:**
71
+ 1. Stop immediately
72
+ 2. Explain what went wrong (simply!)
73
+ 3. Tell them what needs to happen to fix it
74
+ 4. Don't try to fix it yourself
75
+
76
+ **Example:**
77
+ > "I can't continue - there's a git conflict in some files.
78
+ >
79
+ > Files with conflicts:
80
+ > - src/components/Header.tsx
81
+ > - src/utils/auth.ts
82
+ >
83
+ > Once you resolve these (pick which changes to keep), let me know and we'll continue."
84
+
85
+ ---
68
86
 
69
- ### Error Response Templates
87
+ ### How to Explain Problems
70
88
 
71
- **Recoverable:**
89
+ **Don't say this:**
90
+ > "ENOENT: no such file or directory, open '.clavix/outputs/prompts/fast/.index.json'"
91
+
92
+ **Say this:**
93
+ > "Setting up your prompt storage..." (then just create the file)
94
+
95
+ **Don't say this:**
96
+ > "Error: EACCES: permission denied, mkdir '/usr/local/clavix'"
97
+
98
+ **Say this:**
99
+ > "I can't create files in that location - it needs admin permissions.
100
+ > Try running from your project folder instead?"
101
+
102
+ **Don't say this:**
103
+ > "SyntaxError: Unexpected token } in JSON at position 1523"
104
+
105
+ **Say this:**
106
+ > "The settings file got corrupted somehow. I can start fresh if you want,
107
+ > or you can try to fix it manually."
108
+
109
+ ---
110
+
111
+ ### Recovery Templates
112
+
113
+ **For small hiccups (you fixed it):**
72
114
  ```
73
- [Fixed] Created missing .clavix/ directory. Continuing...
115
+ [If worth mentioning]
116
+ "Small hiccup - I've handled it. Moving on..."
117
+
118
+ [Usually just]
119
+ (Say nothing, continue working)
74
120
  ```
75
121
 
76
- **Blocking:**
122
+ **For needing user input:**
77
123
  ```
78
- [Blocked] Multiple projects found. Please select:
79
- 1. auth-feature (75% complete)
80
- 2. api-refactor (0% complete)
124
+ "Quick question: [simple explanation of situation]
81
125
 
82
- Which project should I work with?
126
+ Would you like me to:
127
+ 1. [Option A]
128
+ 2. [Option B]
129
+ 3. [Option C - usually 'skip for now']"
83
130
  ```
84
131
 
85
- **Unrecoverable:**
132
+ **For real problems:**
86
133
  ```
87
- [Error] Cannot continue - manual intervention required.
134
+ "I ran into something I can't fix myself.
88
135
 
89
- Issue: Permission denied writing to /path/to/file
90
- Cause: Insufficient file system permissions
136
+ What happened: [simple explanation]
91
137
 
92
- To resolve:
93
- 1. Check ownership: ls -la /path/to/
94
- 2. Fix permissions: chmod 755 /path/to/
95
- 3. Retry the operation
138
+ To fix this, you'll need to:
139
+ 1. [Step 1]
140
+ 2. [Step 2]
96
141
 
97
- Once resolved, run the command again.
142
+ Once that's done, let me know and we'll pick up where we left off."
98
143
  ```
99
144
 
100
- ### Error Detection Patterns
145
+ ---
146
+
147
+ ### Common Patterns (Internal Reference)
148
+
149
+ **File/Folder Issues:**
150
+ - File not found → Usually create it automatically
151
+ - Already exists → Ask: replace, rename, or cancel?
152
+ - Permission denied → Stop, explain, user needs to fix
153
+ - Disk full → Stop, explain, user needs to free space
154
+
155
+ **Git Issues:**
156
+ - CONFLICT detected → Stop, list files, user must resolve
157
+ - Not a git repo → Ask if they want to initialize one
158
+ - Nothing to commit → Fine, just continue
159
+
160
+ **Settings Issues:**
161
+ - Can't read/parse file → Stop, explain, might need to delete and restart
162
+ - Empty file → Usually just initialize with defaults
101
163
 
102
- **File System Errors:**
103
- - `ENOENT` - File/directory not found → Usually RECOVERABLE
104
- - `EACCES` - Permission denied UNRECOVERABLE
105
- - `EEXIST` - Already exists BLOCKING (ask overwrite)
106
- - `ENOSPC` - No space left → UNRECOVERABLE
164
+ **Task Issues:**
165
+ - Task not found → Show available tasks, ask which one
166
+ - Already completed Tell them, show what's left
167
+ - Wrong order Explain the dependency, offer to fix order
107
168
 
108
- **Git Errors:**
109
- - "CONFLICT" in output → UNRECOVERABLE
110
- - "not a git repository" → BLOCKING (ask to init)
111
- - "nothing to commit" → RECOVERABLE (skip commit)
169
+ ---
112
170
 
113
- **JSON Errors:**
114
- - `SyntaxError: Unexpected token` → UNRECOVERABLE
115
- - Empty file → RECOVERABLE (initialize default)
171
+ ### The Golden Rules
116
172
 
117
- **Task Errors:**
118
- - Task ID not in tasks.md BLOCKING
119
- - Checkbox already checked RECOVERABLE (skip)
120
- - Invalid phase number UNRECOVERABLE
173
+ 1. **Fix it yourself if you can** - Don't bother users with small stuff
174
+ 2. **Explain simply when you can't** - No error codes, no jargon
175
+ 3. **Always offer a path forward** - Never leave them stuck
176
+ 4. **Preserve their work** - Never lose what they've done
177
+ 5. **Stay calm and friendly** - Problems happen, no big deal
@@ -9,6 +9,8 @@
9
9
  - Writing test files for the user's feature
10
10
  - Creating database schemas/migrations
11
11
  - Writing configuration files for deployment
12
+ - **Reading project files to "understand context" before showing analysis**
13
+ - **Exploring the codebase before outputting optimized prompt**
12
14
 
13
15
  ### Mistake Type 2: Skipping Quality Assessment
14
16
  - Not scoring all 6 quality dimensions
@@ -37,6 +39,23 @@
37
39
 
38
40
  **STOP**: Immediately halt the incorrect action
39
41
 
40
- **CORRECT**: Output an acknowledgment and return to correct workflow
42
+ **CORRECT**: Output an acknowledgment:
43
+ > "I was about to [describe action]. Let me return to [fast/deep] prompt analysis."
41
44
 
42
45
  **RESUME**: Return to the appropriate Clavix workflow for this mode
46
+
47
+ ---
48
+
49
+ ## Anti-Implementation Tripwires
50
+
51
+ **Before your next tool call or action, check:**
52
+
53
+ | Action | Tripwire | Response |
54
+ |--------|----------|----------|
55
+ | About to read project files | STOP | "I don't need to explore the codebase for prompt optimization" |
56
+ | About to write code files | STOP | "Only `.clavix/` files are allowed in optimization mode" |
57
+ | About to run build/test commands | STOP | "Project commands are for `/clavix:execute`, not optimization" |
58
+ | About to make git commits | STOP | "Git operations belong in implementation mode" |
59
+ | Haven't shown optimized prompt yet | STOP | "I need to show the analysis first" |
60
+
61
+ **If any tripwire triggers:** Output the response and return to prompt analysis.