clavix 5.5.2 → 5.6.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.
@@ -14,5 +14,6 @@ export default class Init extends Command {
14
14
  private handleLegacyCommands;
15
15
  private injectDocumentation;
16
16
  private extractClavixBlock;
17
+ private generateQuickstart;
17
18
  }
18
19
  //# sourceMappingURL=init.d.ts.map
@@ -2,7 +2,10 @@ import { Command } from '@oclif/core';
2
2
  import inquirer from 'inquirer';
3
3
  import chalk from 'chalk';
4
4
  import * as path from 'path';
5
+ import { fileURLToPath } from 'url';
5
6
  import { AgentManager } from '../../core/agent-manager.js';
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = path.dirname(__filename);
6
9
  import { DocInjector } from '../../core/doc-injector.js';
7
10
  import { AgentsMdGenerator } from '../../core/adapters/agents-md-generator.js';
8
11
  import { OctoMdGenerator } from '../../core/adapters/octo-md-generator.js';
@@ -157,8 +160,9 @@ export default class Init extends Command {
157
160
  // Generate config
158
161
  console.log(chalk.cyan('⚙️ Generating configuration...'));
159
162
  await this.generateConfig(selectedIntegrations);
160
- // Generate INSTRUCTIONS.md
163
+ // Generate INSTRUCTIONS.md and QUICKSTART.md
161
164
  await this.generateInstructions();
165
+ await this.generateQuickstart();
162
166
  // Generate commands for each selected integration
163
167
  console.log(chalk.cyan(`\n📝 Generating commands for ${selectedIntegrations.length} integration(s)...\n`));
164
168
  for (const integrationName of selectedIntegrations) {
@@ -561,5 +565,16 @@ To reconfigure integrations, run \`clavix init\` again.
561
565
  const match = content.match(regex);
562
566
  return match ? match[1].trim() : content;
563
567
  }
568
+ async generateQuickstart() {
569
+ const quickstartPath = path.join(__dirname, '..', '..', 'templates', 'instructions', 'QUICKSTART.md');
570
+ try {
571
+ const quickstartContent = await FileSystem.readFile(quickstartPath);
572
+ await FileSystem.writeFileAtomic('.clavix/QUICKSTART.md', quickstartContent);
573
+ }
574
+ catch {
575
+ // QUICKSTART.md template not found or write failed, skip silently
576
+ // This can happen in test environments or custom installations
577
+ }
578
+ }
564
579
  }
565
580
  //# sourceMappingURL=init.js.map
@@ -169,6 +169,8 @@ For more information, run \`clavix --help\` in your terminal.
169
169
 
170
170
  This project uses Clavix for prompt improvement and PRD generation. The following slash commands are available:
171
171
 
172
+ > **Command Format:** Commands shown with colon (\`:\`) format. Some tools use hyphen (\`-\`): Claude Code uses \`/clavix:improve\`, Cursor uses \`/clavix-improve\`. Your tool autocompletes the correct format.
173
+
172
174
  ### Prompt Optimization
173
175
 
174
176
  #### /clavix:improve [prompt]
@@ -185,7 +187,7 @@ Generate an optimized implementation task breakdown from your PRD. Creates a pha
185
187
  #### /clavix:implement
186
188
  Execute tasks or prompts with AI assistance. Auto-detects source: tasks.md (from PRD workflow) or prompts/ (from improve workflow). Supports automatic git commits and progress tracking.
187
189
 
188
- Use \`--latest\` to execute most recent prompt, \`--tasks\` to force task mode.
190
+ Use \`--latest\` to implement most recent prompt, \`--tasks\` to force task mode.
189
191
 
190
192
  ### Session Management
191
193
 
@@ -51,6 +51,8 @@ export declare class TemplateAssembler {
51
51
  hasIncludes(content: string): boolean;
52
52
  /**
53
53
  * Process all include markers in content
54
+ * @param content - The template content to process
55
+ * @param depth - Current nesting depth (for circular include protection)
54
56
  */
55
57
  private processIncludes;
56
58
  /**
@@ -1,5 +1,15 @@
1
1
  import { promises as fs } from 'fs';
2
2
  import * as path from 'path';
3
+ import { DataError } from '../types/errors.js';
4
+ /**
5
+ * Maximum depth for nested {{INCLUDE:}} directives
6
+ * Prevents infinite loops from circular includes
7
+ */
8
+ const MAX_INCLUDE_DEPTH = 10;
9
+ /**
10
+ * Depth at which to log a warning about deep nesting
11
+ */
12
+ const DEPTH_WARNING_THRESHOLD = 5;
3
13
  /**
4
14
  * TemplateAssembler - v4.0 Template Modularity System
5
15
  *
@@ -30,13 +40,13 @@ export class TemplateAssembler {
30
40
  async assembleTemplate(templatePath) {
31
41
  const fullPath = path.join(this.templatesBasePath, 'slash-commands', '_canonical', templatePath);
32
42
  const content = await this.loadFile(fullPath);
33
- return this.processIncludes(content);
43
+ return this.processIncludes(content, 0);
34
44
  }
35
45
  /**
36
46
  * Assemble template from raw content string
37
47
  */
38
48
  async assembleFromContent(content) {
39
- return this.processIncludes(content);
49
+ return this.processIncludes(content, 0);
40
50
  }
41
51
  /**
42
52
  * Check if a template contains include markers
@@ -46,8 +56,19 @@ export class TemplateAssembler {
46
56
  }
47
57
  /**
48
58
  * Process all include markers in content
59
+ * @param content - The template content to process
60
+ * @param depth - Current nesting depth (for circular include protection)
49
61
  */
50
- async processIncludes(content) {
62
+ async processIncludes(content, depth) {
63
+ // Circular include protection
64
+ if (depth > MAX_INCLUDE_DEPTH) {
65
+ throw new DataError(`Maximum include depth (${MAX_INCLUDE_DEPTH}) exceeded`, 'Check for circular {{INCLUDE:}} references in templates');
66
+ }
67
+ // Warn about deep nesting
68
+ if (depth === DEPTH_WARNING_THRESHOLD) {
69
+ console.warn(`[TemplateAssembler] Warning: Include depth ${depth} reached. ` +
70
+ 'Consider flattening template structure.');
71
+ }
51
72
  const includedComponents = [];
52
73
  const missingComponents = [];
53
74
  const variablesUsed = new Set();
@@ -86,9 +107,9 @@ export class TemplateAssembler {
86
107
  processedContent = processedContent.replace(fullMatch, `<!-- MISSING COMPONENT: ${componentPath} -->`);
87
108
  }
88
109
  }
89
- // Process nested includes (recursive)
110
+ // Process nested includes (recursive with depth tracking)
90
111
  if (this.hasIncludes(processedContent)) {
91
- const nestedResult = await this.processIncludes(processedContent);
112
+ const nestedResult = await this.processIncludes(processedContent, depth + 1);
92
113
  processedContent = nestedResult.content;
93
114
  includedComponents.push(...nestedResult.includedComponents);
94
115
  missingComponents.push(...nestedResult.missingComponents);
@@ -80,6 +80,8 @@ For complete step-by-step workflows, see `.clavix/instructions/`:
80
80
  ### Workflow Commands (Slash Commands)
81
81
  All workflows are executed via slash commands that AI agents read and follow:
82
82
 
83
+ > **Command Format:** Commands shown with colon (`:`) format. Some tools use hyphen (`-`): Claude Code uses `/clavix:improve`, Cursor uses `/clavix-improve`. Your tool autocompletes the correct format.
84
+
83
85
  | Slash Command | Purpose |
84
86
  |---------------|---------|
85
87
  | `/clavix:improve` | Optimize prompts (auto-selects depth) |
@@ -0,0 +1,65 @@
1
+ # Clavix Quick Reference
2
+
3
+ ## Commands at a Glance
4
+
5
+ | Command | Purpose | Mode |
6
+ |---------|---------|------|
7
+ | `/clavix:improve` | Optimize a prompt with auto-depth | Planning |
8
+ | `/clavix:prd` | Generate PRD via strategic questions | Planning |
9
+ | `/clavix:plan` | Create task breakdown from PRD | Planning |
10
+ | `/clavix:implement` | Execute tasks or prompts | Implementation |
11
+ | `/clavix:start` | Begin conversational exploration | Planning |
12
+ | `/clavix:summarize` | Extract requirements from conversation | Planning |
13
+ | `/clavix:refine` | Update existing PRD or prompt | Planning |
14
+ | `/clavix:verify` | Check implementation against requirements | Verification |
15
+ | `/clavix:archive` | Move completed project to archive | Management |
16
+
17
+ > **Command Format:** Commands shown with colon (`:`) format. Some tools use hyphen (`-`): Claude Code uses `/clavix:improve`, Cursor uses `/clavix-improve`. Your tool autocompletes the correct format.
18
+
19
+ ## Common Workflows
20
+
21
+ **Quick optimization:**
22
+ ```
23
+ /clavix:improve "your prompt here"
24
+ → /clavix:implement --latest
25
+ ```
26
+
27
+ **Full planning cycle:**
28
+ ```
29
+ /clavix:prd
30
+ → /clavix:plan
31
+ → /clavix:implement
32
+ → /clavix:verify
33
+ → /clavix:archive
34
+ ```
35
+
36
+ **Exploratory approach:**
37
+ ```
38
+ /clavix:start
39
+ → (conversation)
40
+ → /clavix:summarize
41
+ → /clavix:plan
42
+ → /clavix:implement
43
+ ```
44
+
45
+ ## Key Directories
46
+
47
+ - `.clavix/outputs/` — Generated PRDs, tasks, prompts
48
+ - `.clavix/outputs/prompts/` — Saved optimized prompts
49
+ - `.clavix/outputs/archive/` — Archived completed projects
50
+ - `.clavix/instructions/` — Detailed workflow documentation
51
+
52
+ ## Mode Boundaries
53
+
54
+ - **Planning Mode** (improve, prd, plan, start, summarize, refine): NO code generation
55
+ - **Implementation Mode** (implement): Code generation ALLOWED
56
+ - **Verification Mode** (verify): Read-only checks
57
+ - **Management Mode** (archive): File organization only
58
+
59
+ ## Getting Started
60
+
61
+ 1. Run `clavix init` to set up your project
62
+ 2. Use `/clavix:improve "your idea"` to optimize a prompt
63
+ 3. Use `/clavix:implement --latest` to implement it
64
+
65
+ For detailed documentation, see `.clavix/instructions/` in your project.
@@ -326,9 +326,9 @@ Before considering this task complete, verify:
326
326
 
327
327
  ---
328
328
 
329
- ## CHECKPOINT: Analysis Complete?
329
+ **CHECKPOINT:** Analysis Complete
330
330
 
331
- **Before proceeding to save, verify you have output ALL of the following:**
331
+ Before proceeding to save, verify you have output ALL of the following:
332
332
 
333
333
  **Standard Depth:**
334
334
  - [ ] **Intent Analysis** with type and confidence
@@ -349,9 +349,9 @@ Before considering this task complete, verify:
349
349
 
350
350
  ---
351
351
 
352
- ## SAVING CHECKPOINT (REQUIRED - DO NOT SKIP)
352
+ **CHECKPOINT:** Saving Protocol (REQUIRED - DO NOT SKIP)
353
353
 
354
- **DO NOT output any "saved" message until you have COMPLETED and VERIFIED all save steps.**
354
+ DO NOT output any "saved" message until you have COMPLETED and VERIFIED all save steps.
355
355
 
356
356
  This is a BLOCKING checkpoint. You cannot proceed to the final message until saving is verified.
357
357
 
@@ -252,11 +252,17 @@ mkdir -p .clavix/outputs/{sanitized-project-name}
252
252
  ```
253
253
 
254
254
  ### Step 5: Verify Files Were Created
255
- ```bash
256
- ls .clavix/outputs/{project-name}/
257
- ```
258
255
 
259
- **Expected output**:
256
+ **Verification Protocol:**
257
+ 1. **Immediately after Write**, use Read tool to verify each file:
258
+ - Read `.clavix/outputs/{project-name}/full-prd.md`
259
+ - Confirm content matches what you wrote
260
+ - Read `.clavix/outputs/{project-name}/quick-prd.md`
261
+ - Confirm content matches what you wrote
262
+
263
+ 2. **If Read fails**: STOP and report error to user
264
+
265
+ **Expected files**:
260
266
  - `full-prd.md`
261
267
  - `quick-prd.md`
262
268
 
@@ -9,9 +9,11 @@ Core protocols that all AI agents must follow. Shared across most commands.
9
9
 
10
10
  | Component | Purpose | Used By |
11
11
  |-----------|---------|---------|
12
- | `AGENT_MANUAL.md` | Universal protocols (transparency, mode identification, communication patterns) | All 8 commands |
12
+ | `AGENT_MANUAL.md` | Universal protocols (transparency, mode identification, communication patterns) | All 9 commands |
13
13
  | `cli-reference.md` | CLI command reference including removed commands table | improve, prd, plan, implement, verify, archive |
14
14
  | `state-awareness.md` | Workflow state detection (mid-PRD, mid-implementation, etc.) | prd, plan, implement, summarize |
15
+ | `state-assertion.md` | Required mode assertion output (MODE, Purpose, Implementation status) | Available for all commands |
16
+ | `self-correction-protocol.md` | Mistake detection and correction patterns (supports variables) | Available for all commands |
15
17
  | `supportive-companion.md` | Conversational guidance for start mode | start |
16
18
  | `task-blocking.md` | Task execution protocols for implement mode | implement |
17
19
 
@@ -63,6 +65,18 @@ Components are included using the `{{INCLUDE:path}}` directive:
63
65
  {{INCLUDE:references/quality-dimensions.md}}
64
66
  ```
65
67
 
68
+ ### Variable Interpolation
69
+
70
+ Components can accept variables for customization:
71
+
72
+ ```markdown
73
+ {{INCLUDE:agent-protocols/state-assertion.md MODE_NAME="Improve" MODE_TYPE="planning" MODE_PURPOSE="Optimizing prompts" IMPL_STATUS="BLOCKED"}}
74
+ ```
75
+
76
+ Variables use mustache-style syntax:
77
+ - `{{VAR_NAME}}` - Simple replacement
78
+ - `{{#VAR_NAME}}content{{/VAR_NAME}}` - Conditional block (shown if VAR_NAME is set)
79
+
66
80
  ## Guidelines for New Components
67
81
 
68
82
  1. **Single responsibility**: Each component should have one clear purpose
@@ -0,0 +1,21 @@
1
+ ## Self-Correction Protocol
2
+
3
+ **DETECT**: If you find yourself doing any of these mistake types:
4
+
5
+ | Type | What It Looks Like |
6
+ |------|--------------------|
7
+ | 1. Implementation Code | Writing function/class definitions, creating components, generating API endpoints |
8
+ | 2. {{MISTAKE_2}} | {{MISTAKE_2_DESC}} |
9
+ | 3. {{MISTAKE_3}} | {{MISTAKE_3_DESC}} |
10
+ | 4. {{MISTAKE_4}} | {{MISTAKE_4_DESC}} |
11
+ | 5. {{MISTAKE_5}} | {{MISTAKE_5_DESC}} |
12
+ | 6. Capability Hallucination | Claiming features Clavix doesn't have, inventing pattern names |
13
+
14
+ **STOP**: Immediately halt the incorrect action
15
+
16
+ **CORRECT**: Output:
17
+ "I apologize - I was [describe mistake]. Let me return to {{MODE_NAME}}."
18
+
19
+ **RESUME**: Return to the {{MODE_NAME}} workflow with correct approach.
20
+
21
+ ---
@@ -0,0 +1,12 @@
1
+ ## State Assertion (REQUIRED)
2
+
3
+ **Before starting {{ACTION}}, output:**
4
+ ```
5
+ **CLAVIX MODE: {{MODE_NAME}}**
6
+ Mode: {{MODE_TYPE}}
7
+ Purpose: {{MODE_PURPOSE}}
8
+ {{#EXTRA_FIELD}}{{EXTRA_FIELD}}{{/EXTRA_FIELD}}
9
+ Implementation: {{IMPL_STATUS}}
10
+ ```
11
+
12
+ ---
@@ -279,6 +279,28 @@ Copy and fill in:
279
279
 
280
280
  ---
281
281
 
282
+ ## Quick PRD Examples
283
+
284
+ Quick PRDs condense the full PRD into 2-3 AI-optimized paragraphs for efficient agent consumption.
285
+
286
+ ### Quick PRD Example 1: Habit Tracker
287
+
288
+ **Goal:** Build a mobile-first habit tracking app that helps users build consistent daily routines through streak tracking, reminders, and progress visualization. Target users are productivity-focused individuals who want simple habit management without complex features.
289
+
290
+ **Core Features:** Daily habit check-in with streak counter, customizable reminder notifications, weekly/monthly progress charts, habit templates for common goals (exercise, reading, meditation). Tech stack: React Native, local storage with optional cloud sync.
291
+
292
+ **Scope Boundaries:** No social features, no gamification beyond streaks, no premium tiers. Focus on core tracking reliability over feature breadth.
293
+
294
+ ### Quick PRD Example 2: API User Management
295
+
296
+ **Goal:** Create a RESTful user management microservice for the existing e-commerce platform, handling authentication, authorization, and user profile CRUD operations. Must integrate with existing PostgreSQL database and support OAuth2.
297
+
298
+ **Core Features:** JWT-based authentication, role-based access control (admin/user/guest), user registration with email verification, password reset flow, profile management endpoints. Built with Node.js/Express, PostgreSQL, Redis for session caching.
299
+
300
+ **Scope Boundaries:** No frontend components, no payment integration, no analytics dashboard. Service-only implementation with OpenAPI documentation.
301
+
302
+ ---
303
+
282
304
  ### Key Elements of a Good Mini-PRD
283
305
 
284
306
  1. **Clear problem statement** - Why are we building this?
@@ -17,7 +17,7 @@ export class AgentErrorMessages {
17
17
  'Agent recovery options:\n' +
18
18
  ' 1. Execute /clavix:prd to generate comprehensive PRD\n' +
19
19
  ' 2. Execute /clavix:summarize if conversation exists\n\n' +
20
- 'Select option and execute, then retry this command.');
20
+ 'Select option and run, then retry this command.');
21
21
  }
22
22
  /**
23
23
  * Error: No tasks.md found for specified project
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavix",
3
- "version": "5.5.2",
3
+ "version": "5.6.0",
4
4
  "description": "Agentic-first prompt workflows. Markdown templates that teach AI agents how to optimize prompts, create PRDs, and manage implementation.\n\nSLASH COMMANDS (in your AI assistant):\n /clavix:improve Optimize prompts with auto-depth\n /clavix:prd Generate PRD through questions\n /clavix:plan Create task breakdown from PRD\n /clavix:implement Execute tasks with progress tracking\n /clavix:start Begin conversational session\n /clavix:summarize Extract requirements from conversation\n\nWorks with Claude Code, Cursor, Windsurf, and 19+ other AI coding tools.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",