@compilr-dev/agents 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/agent.d.ts CHANGED
@@ -1457,6 +1457,9 @@ export declare class Agent {
1457
1457
  /**
1458
1458
  * Generate a summary of messages using the LLM provider.
1459
1459
  * Used for context summarization when approaching limits.
1460
+ *
1461
+ * If anchors are configured, the summary will prioritize keeping
1462
+ * information related to anchor content (anchor-weighted summarization).
1460
1463
  */
1461
1464
  private generateSummary;
1462
1465
  /**
package/dist/agent.js CHANGED
@@ -2149,14 +2149,36 @@ export class Agent {
2149
2149
  /**
2150
2150
  * Generate a summary of messages using the LLM provider.
2151
2151
  * Used for context summarization when approaching limits.
2152
+ *
2153
+ * If anchors are configured, the summary will prioritize keeping
2154
+ * information related to anchor content (anchor-weighted summarization).
2152
2155
  */
2153
2156
  async generateSummary(messages) {
2157
+ // Build anchor context if available (for weighted summarization)
2158
+ let anchorContext = '';
2159
+ if (this.anchorManager && this.anchorManager.size > 0) {
2160
+ const anchors = this.anchorManager.getAll();
2161
+ if (anchors.length > 0) {
2162
+ const anchorItems = anchors.map((a) => `- [${a.priority}] ${a.content}`).join('\n');
2163
+ anchorContext = `
2164
+ ## PRIORITY CONTEXT (Anchors)
2165
+
2166
+ The following are critical anchors that should be preserved in context. When summarizing,
2167
+ PRIORITIZE keeping information that relates to these anchors:
2168
+
2169
+ ${anchorItems}
2170
+
2171
+ Ensure the summary captures any conversation details related to these anchors.
2172
+ `;
2173
+ }
2174
+ }
2154
2175
  const summaryPrompt = `Please provide a concise summary of the following conversation. Focus on:
2155
2176
  1. Key decisions made
2156
2177
  2. Important context established
2157
2178
  3. Tasks completed or in progress
2158
2179
  4. Any relevant file paths or code snippets mentioned
2159
-
2180
+ ${anchorContext ? '5. Information related to the priority anchors listed below' : ''}
2181
+ ${anchorContext}
2160
2182
  Keep the summary under 500 words.
2161
2183
 
2162
2184
  Conversation to summarize:
@@ -7,14 +7,14 @@
7
7
  * @example
8
8
  * ```typescript
9
9
  * const provider = createOllamaProvider({
10
- * model: 'llama3.1',
10
+ * model: 'llama3.2',
11
11
  * baseUrl: 'http://localhost:11434'
12
12
  * });
13
13
  * ```
14
14
  *
15
15
  * @remarks
16
16
  * - Requires Ollama to be running locally
17
- * - Default model is llama3.1 (supports tool calling)
17
+ * - Default model is llama3.2 (supports tool calling)
18
18
  * - Extended thinking is not supported (Claude-specific feature)
19
19
  */
20
20
  import type { ChatOptions } from './types.js';
@@ -7,20 +7,20 @@
7
7
  * @example
8
8
  * ```typescript
9
9
  * const provider = createOllamaProvider({
10
- * model: 'llama3.1',
10
+ * model: 'llama3.2',
11
11
  * baseUrl: 'http://localhost:11434'
12
12
  * });
13
13
  * ```
14
14
  *
15
15
  * @remarks
16
16
  * - Requires Ollama to be running locally
17
- * - Default model is llama3.1 (supports tool calling)
17
+ * - Default model is llama3.2 (supports tool calling)
18
18
  * - Extended thinking is not supported (Claude-specific feature)
19
19
  */
20
20
  import { ProviderError } from '../errors.js';
21
21
  import { OpenAICompatibleProvider } from './openai-compatible.js';
22
22
  // Default configuration
23
- const DEFAULT_MODEL = 'llama3.1';
23
+ const DEFAULT_MODEL = 'llama3.2';
24
24
  const DEFAULT_BASE_URL = 'http://localhost:11434';
25
25
  /**
26
26
  * Ollama LLM Provider
@@ -172,93 +172,439 @@ export const builtinSkills = [
172
172
  defineSkill({
173
173
  name: 'code-review',
174
174
  description: 'Perform a thorough code review',
175
- prompt: `You are now in code review mode. When reviewing code:
175
+ prompt: `You are now in CODE REVIEW MODE.
176
176
 
177
- 1. **Security**: Check for vulnerabilities (injection, XSS, auth issues)
178
- 2. **Performance**: Identify bottlenecks and optimization opportunities
179
- 3. **Maintainability**: Evaluate code clarity, naming, and structure
180
- 4. **Best Practices**: Check for anti-patterns and code smells
181
- 5. **Testing**: Assess test coverage and edge cases
177
+ ## Purpose
178
+ Perform a thorough, actionable code review.
182
179
 
183
- Provide specific, actionable feedback with line references.
184
- Format: List issues by severity (Critical, High, Medium, Low).`,
180
+ ## When to Use
181
+ - User asks to review code, PR, or changes
182
+ - Before merging a feature branch
183
+ - After implementing a feature
184
+
185
+ ## When NOT to Use
186
+ - User just wants to understand code → use explain skill
187
+ - Code is already in production and can't change
188
+ - User wants security-specific review → use security-review skill
189
+
190
+ ## Workflow
191
+
192
+ ### Phase 1: Understand Context
193
+ 1. Read the files being reviewed
194
+ 2. Check git status for what changed
195
+ 3. Review the diff to see actual changes
196
+
197
+ ### Phase 2: Review by Severity
198
+
199
+ **Critical** (must fix before merge):
200
+ - Security vulnerabilities (injection, XSS, auth bypass)
201
+ - Data loss risks
202
+ - Breaking changes to public APIs
203
+
204
+ **High** (should fix):
205
+ - Logic errors / bugs
206
+ - Missing error handling for likely cases
207
+ - Performance issues (N+1 queries, unbounded loops)
208
+
209
+ **Medium** (consider fixing):
210
+ - Code clarity / naming issues
211
+ - Missing tests for new code
212
+ - Inconsistent patterns
213
+
214
+ **Low** (optional):
215
+ - Style preferences
216
+ - Minor optimizations
217
+
218
+ ### Phase 3: Report
219
+ Format findings with file:line references:
220
+ \`\`\`
221
+ ## Code Review: [file/feature]
222
+
223
+ ### Critical Issues
224
+ - **src/auth.ts:42**: SQL injection risk → use parameterized query
225
+
226
+ ### High Priority
227
+ - **src/api.ts:15**: Missing null check → add guard
228
+
229
+ ### Suggestions
230
+ - Consider extracting duplicate logic
231
+
232
+ ### What's Good
233
+ - Clear naming, good test coverage
234
+ \`\`\`
235
+
236
+ ## Rules
237
+ - Read the code before reviewing - never review blind
238
+ - Be specific with line references
239
+ - Suggest fixes, not just problems
240
+ - Distinguish blocking vs non-blocking issues
241
+ - Don't nitpick style if code works
242
+
243
+ ## Completion Criteria
244
+ ✓ All changed files reviewed
245
+ ✓ Issues categorized by severity
246
+ ✓ Actionable suggestions provided`,
185
247
  tags: ['development', 'review'],
186
248
  }),
187
249
  defineSkill({
188
250
  name: 'debug',
189
251
  description: 'Systematic debugging approach',
190
- prompt: `You are now in debugging mode. Follow this systematic approach:
191
-
192
- 1. **Reproduce**: Ensure the issue can be consistently reproduced
193
- 2. **Isolate**: Narrow down the scope to specific components
194
- 3. **Analyze**: Examine logs, stack traces, and state
195
- 4. **Hypothesize**: Form theories about root cause
196
- 5. **Test**: Verify hypotheses with targeted tests
197
- 6. **Fix**: Implement and validate the fix
198
- 7. **Document**: Note the issue and solution for future reference
199
-
200
- Be methodical and avoid jumping to conclusions.`,
252
+ prompt: `You are now in DEBUG MODE.
253
+
254
+ ## Purpose
255
+ Systematically investigate and fix issues.
256
+
257
+ ## When to Use
258
+ - User reports a bug or error
259
+ - Tests are failing
260
+ - Unexpected behavior occurs
261
+
262
+ ## When NOT to Use
263
+ - User wants to add a feature → use build skill
264
+ - User wants to understand code → use explain skill
265
+ - User wants code improvements → use refactor skill
266
+
267
+ ## Workflow
268
+
269
+ ### Phase 1: Reproduce
270
+ 1. Understand expected vs actual behavior
271
+ 2. Get error messages/stack traces if available
272
+ 3. Identify steps to reproduce
273
+
274
+ ### Phase 2: Isolate
275
+ 1. Find relevant code using grep or glob
276
+ 2. Read the suspected files
277
+ 3. Narrow down to specific function/line
278
+
279
+ ### Phase 3: Hypothesize
280
+ Form theories about root cause:
281
+ - Input validation issue?
282
+ - State management bug?
283
+ - Race condition?
284
+ - Missing error handling?
285
+ - Wrong assumption about data?
286
+
287
+ ### Phase 4: Verify
288
+ 1. Add logging/checks to confirm hypothesis
289
+ 2. Run tests to validate
290
+ 3. If hypothesis wrong, return to Phase 2
291
+
292
+ ### Phase 5: Fix
293
+ 1. Make minimal change to fix the issue
294
+ 2. Run tests to confirm fix works
295
+ 3. Check for regressions
296
+
297
+ ### Phase 6: Document
298
+ - Add test case for the bug if missing
299
+ - Add comment if fix is non-obvious
300
+
301
+ ## Common Patterns
302
+
303
+ | Symptom | Likely Cause |
304
+ |---------|--------------|
305
+ | "undefined is not a function" | Missing import, typo |
306
+ | "Cannot read property of null" | Unhandled null case |
307
+ | "Network error" | API/CORS issue |
308
+ | Works locally, fails in CI | Environment difference |
309
+
310
+ ## Rules
311
+ - Read the code before suggesting fixes
312
+ - Don't guess - investigate systematically
313
+ - Make minimal changes - fix the bug, don't refactor
314
+ - Verify the fix actually works
315
+
316
+ ## Completion Criteria
317
+ ✓ Bug is reproduced and understood
318
+ ✓ Root cause identified
319
+ ✓ Fix implemented and tested
320
+ ✓ No regressions introduced`,
201
321
  tags: ['development', 'troubleshooting'],
202
322
  }),
203
323
  defineSkill({
204
324
  name: 'explain',
205
325
  description: 'Explain code or concepts clearly',
206
- prompt: `You are now in explanation mode. When explaining:
207
-
208
- 1. Start with a high-level overview
209
- 2. Break down complex concepts into smaller parts
210
- 3. Use analogies and examples where helpful
211
- 4. Highlight key points and takeaways
212
- 5. Provide context for why things work the way they do
213
- 6. Tailor complexity to the audience level
214
-
215
- Be clear, concise, and avoid unnecessary jargon.`,
326
+ prompt: `You are now in EXPLAIN MODE.
327
+
328
+ ## Purpose
329
+ Clearly explain code, concepts, or architecture.
330
+
331
+ ## When to Use
332
+ - User asks "what does X do?"
333
+ - User asks "how does X work?"
334
+ - User is learning the codebase
335
+
336
+ ## When NOT to Use
337
+ - User wants to change the code → use appropriate skill (refactor, debug, build)
338
+ - User wants a code review → use code-review skill
339
+ - User wants security analysis → use security-review skill
340
+
341
+ ## Approach
342
+
343
+ ### For Code Explanation
344
+ 1. Read the actual code first - never explain from memory
345
+ 2. Start with high-level purpose (1-2 sentences)
346
+ 3. Walk through key parts with line references (file.ts:42)
347
+ 4. Explain non-obvious logic
348
+ 5. Note dependencies and side effects
349
+
350
+ ### For Concept Explanation
351
+ 1. Start with simple definition
352
+ 2. Use analogies if helpful
353
+ 3. Show concrete example
354
+ 4. Mention common pitfalls
355
+
356
+ ### For Architecture Explanation
357
+ 1. Start with component overview
358
+ 2. Explain data flow
359
+ 3. Note key decisions and trade-offs
360
+ 4. Reference relevant files
361
+
362
+ ## Rules
363
+ - Read the actual code - don't explain from memory
364
+ - Use line references: src/auth.ts:42
365
+ - Match complexity to user's apparent level
366
+ - Avoid jargon unless necessary
367
+ - If you don't know, say so
368
+
369
+ ## Completion Criteria
370
+ ✓ User's question is answered
371
+ ✓ Explanation is grounded in actual code
372
+ ✓ Complex parts are broken down clearly`,
216
373
  tags: ['education', 'documentation'],
217
374
  }),
218
375
  defineSkill({
219
376
  name: 'refactor',
220
377
  description: 'Guide code refactoring',
221
- prompt: `You are now in refactoring mode. When refactoring:
222
-
223
- 1. **Understand**: Fully understand existing behavior before changing
224
- 2. **Test First**: Ensure tests exist to catch regressions
225
- 3. **Small Steps**: Make incremental, reversible changes
226
- 4. **Single Purpose**: Each refactor should have one clear goal
227
- 5. **Preserve Behavior**: No functional changes during refactoring
228
- 6. **Clean Up**: Remove dead code, simplify complexity
229
-
230
- Follow established patterns and maintain consistency with the codebase.`,
378
+ prompt: `You are now in REFACTOR MODE.
379
+
380
+ ## Purpose
381
+ Safely restructure code without changing behavior.
382
+
383
+ ## When to Use
384
+ - Code is hard to understand/maintain
385
+ - Preparing code for a new feature
386
+ - Reducing duplication
387
+ - Improving performance
388
+
389
+ ## When NOT to Use
390
+ - Adding new features → use build skill
391
+ - Fixing bugs → use debug skill (behavior change)
392
+ - Just cosmetic changes → not worth the risk
393
+ - No tests exist → add tests first
394
+
395
+ ## Workflow
396
+
397
+ ### Phase 1: Understand
398
+ 1. Read the code to refactor
399
+ 2. Identify what calls this code (find references)
400
+ 3. Check for existing tests
401
+
402
+ ### Phase 2: Ensure Safety
403
+ 1. Run existing tests first
404
+ 2. If no tests, consider adding them first
405
+ 3. Note the current behavior precisely
406
+
407
+ ### Phase 3: Plan
408
+ Identify the specific refactoring:
409
+ - Extract function/method
410
+ - Rename for clarity
411
+ - Reduce duplication
412
+ - Simplify conditionals
413
+ - Split large file
414
+
415
+ ### Phase 4: Execute
416
+ 1. Make ONE refactoring at a time
417
+ 2. Run tests after each change
418
+ 3. If tests fail, revert and try smaller step
419
+
420
+ ### Phase 5: Verify
421
+ 1. Run full test suite
422
+ 2. Run linter
423
+ 3. Review the diff
424
+
425
+ ## Red Flags - Stop and Reconsider
426
+ - No tests exist for this code
427
+ - You're tempted to add features
428
+ - The change touches many files
429
+ - You don't fully understand the code
430
+
431
+ ## Rules
432
+ - NEVER change behavior during refactoring
433
+ - Make small, reversible changes
434
+ - Test after every change
435
+ - Read the code before changing it
436
+ - If also fixing bugs, do that separately
437
+
438
+ ## Completion Criteria
439
+ ✓ Code is improved (clearer, simpler, less duplication)
440
+ ✓ Behavior is unchanged (tests pass)
441
+ ✓ No new warnings/errors introduced`,
231
442
  tags: ['development', 'improvement'],
232
443
  }),
233
444
  defineSkill({
234
445
  name: 'planning',
235
446
  description: 'Help plan and structure work',
236
- prompt: `You are now in planning mode. When planning:
447
+ prompt: `You are now in PLANNING MODE.
448
+
449
+ ## Purpose
450
+ Break down work into clear, actionable steps.
451
+
452
+ ## When to Use
453
+ - Complex feature with multiple parts
454
+ - User asks "how should I approach X?"
455
+ - Before starting significant work
456
+
457
+ ## When NOT to Use
458
+ - Simple, obvious tasks → just do them
459
+ - User already has a clear plan
460
+ - Pure research questions → use explain skill
461
+
462
+ ## Workflow
463
+
464
+ ### Phase 1: Clarify Goals
465
+ 1. What is the desired outcome?
466
+ 2. What are the constraints?
467
+ 3. What's out of scope?
468
+
469
+ If unclear, ask the user to clarify.
470
+
471
+ ### Phase 2: Assess Current State
472
+ 1. Read relevant code
473
+ 2. Check project structure
474
+ 3. Identify what exists vs needs to be built
475
+
476
+ ### Phase 3: Break Down
477
+ Create actionable items:
478
+ - Each item completable in one session
479
+ - Items have clear completion criteria
480
+ - Order by dependencies (what blocks what?)
481
+
482
+ ### Phase 4: Identify Risks
483
+ - What could go wrong?
484
+ - What unknowns need investigation?
485
+ - What dependencies might cause issues?
486
+
487
+ ### Phase 5: Present Plan
488
+ Format as:
489
+ \`\`\`
490
+ ## Plan: [Feature Name]
491
+
492
+ ### Goal
493
+ [1-2 sentences]
494
+
495
+ ### Steps
496
+ 1. [ ] [Task] - [brief description]
497
+ 2. [ ] [Task] - [brief description]
498
+ ...
237
499
 
238
- 1. **Clarify Goals**: Understand the desired outcome
239
- 2. **Break Down**: Divide into manageable tasks
240
- 3. **Dependencies**: Identify task dependencies and order
241
- 4. **Risks**: Anticipate potential blockers
242
- 5. **Milestones**: Define checkpoints to measure progress
243
- 6. **Resources**: Identify what's needed
500
+ ### Risks
501
+ - [Risk]: [mitigation]
502
+
503
+ ### Open Questions
504
+ - [Question needing user input]
505
+ \`\`\`
244
506
 
245
- Provide actionable plans with clear next steps.`,
507
+ ## Rules
508
+ - Don't plan trivial tasks - just do them
509
+ - Be specific - "implement auth" is too vague
510
+ - Consider dependencies between steps
511
+ - Include verification steps (tests, manual check)
512
+ - Don't give time estimates
513
+
514
+ ## Completion Criteria
515
+ ✓ Goal is clear
516
+ ✓ Steps are actionable and ordered
517
+ ✓ Risks are identified
518
+ ✓ User agrees with the approach`,
246
519
  tags: ['project-management', 'organization'],
247
520
  }),
248
521
  defineSkill({
249
522
  name: 'security-review',
250
523
  description: 'Focus on security aspects',
251
- prompt: `You are now in security review mode. Focus on:
524
+ prompt: `You are now in SECURITY REVIEW MODE.
525
+
526
+ ## Purpose
527
+ Identify security vulnerabilities in code.
528
+
529
+ ## When to Use
530
+ - Before deploying to production
531
+ - Reviewing authentication/authorization code
532
+ - Handling user input or sensitive data
533
+ - Third-party integration code
534
+
535
+ ## When NOT to Use
536
+ - General code quality issues → use code-review skill
537
+ - Performance issues → use code-optimization skill
538
+ - Just want to understand code → use explain skill
539
+
540
+ ## Workflow
541
+
542
+ ### Phase 1: Identify Attack Surface
543
+ 1. Find entry points: APIs, forms, file uploads
544
+ 2. Find data flows: user input → storage → output
545
+ 3. Find sensitive operations: auth, payments, admin
546
+
547
+ ### Phase 2: Check OWASP Top 10
548
+
549
+ **1. Injection (SQL, Command, XSS)**
550
+ - Is user input sanitized before queries?
551
+ - Are parameterized queries used?
552
+ - Is output encoded/escaped?
553
+
554
+ **2. Broken Authentication**
555
+ - Are passwords hashed properly (bcrypt, argon2)?
556
+ - Are sessions managed securely?
557
+ - Is MFA available for sensitive ops?
558
+
559
+ **3. Sensitive Data Exposure**
560
+ - Is data encrypted in transit (HTTPS)?
561
+ - Are secrets in environment variables (not code)?
562
+ - Is sensitive data logged?
563
+
564
+ **4. Broken Access Control**
565
+ - Are authorization checks on every endpoint?
566
+ - Can users access other users' data?
567
+ - Are admin functions protected?
568
+
569
+ **5. Security Misconfiguration**
570
+ - Are default credentials changed?
571
+ - Are error messages generic (no stack traces)?
572
+ - Are unnecessary features disabled?
573
+
574
+ **6. Using Vulnerable Components**
575
+ - Run findVulnerabilities() or npm audit
576
+ - Check for outdated dependencies
577
+
578
+ ### Phase 3: Report Findings
579
+
580
+ Format as:
581
+ \`\`\`
582
+ ## Security Review: [component]
252
583
 
253
- 1. **Authentication**: Verify proper auth mechanisms
254
- 2. **Authorization**: Check access control at every level
255
- 3. **Input Validation**: Look for injection vulnerabilities
256
- 4. **Data Protection**: Ensure sensitive data is protected
257
- 5. **Dependencies**: Check for known vulnerabilities
258
- 6. **Configuration**: Review security settings
259
- 7. **Logging**: Verify security events are logged
584
+ ### Critical (immediate action)
585
+ - **file:line**: [vulnerability]
586
+ Risk: [impact]
587
+ Fix: [solution]
260
588
 
261
- Apply OWASP guidelines and security best practices.`,
589
+ ### High (fix before deploy)
590
+ ...
591
+
592
+ ### Recommendations
593
+ - [proactive improvements]
594
+ \`\`\`
595
+
596
+ ## Rules
597
+ - Be specific about the vulnerability
598
+ - Explain the real-world impact
599
+ - Provide actionable fix suggestions
600
+ - Don't cry wolf - prioritize real risks
601
+ - Check for existing security controls first
602
+
603
+ ## Completion Criteria
604
+ ✓ Attack surface identified
605
+ ✓ OWASP categories checked
606
+ ✓ Findings prioritized by severity
607
+ ✓ Fix suggestions provided`,
262
608
  tags: ['security', 'review'],
263
609
  }),
264
610
  defineSkill({
@@ -266,6 +612,16 @@ Apply OWASP guidelines and security best practices.`,
266
612
  description: 'Guide user through project design and requirements gathering',
267
613
  prompt: `You are in DESIGN MODE. Your goal is to gather enough information to populate the project backlog with 5-15 actionable items.
268
614
 
615
+ ## When to Use
616
+ - Starting a new project from scratch
617
+ - User has an idea but no clear requirements
618
+ - Need to create initial backlog
619
+
620
+ ## When NOT to Use
621
+ - Project already has requirements → use refine skill
622
+ - Quick project outline needed → use sketch skill
623
+ - Just need to update PRD → use prd skill
624
+
269
625
  ## PHASES
270
626
 
271
627
  ### Phase 1: Vision (3-5 questions)
@@ -333,6 +689,17 @@ When you have enough information:
333
689
  description: 'Iteratively refine and expand project requirements',
334
690
  prompt: `You are in REFINE MODE. Your goal is to deepen and expand existing requirements based on user feedback.
335
691
 
692
+ ## When to Use
693
+ - Backlog items are too vague
694
+ - Need to add acceptance criteria
695
+ - Reprioritizing existing items
696
+ - Adding missing items to backlog
697
+
698
+ ## When NOT to Use
699
+ - No backlog exists yet → use design skill
700
+ - Quick outline needed → use sketch skill
701
+ - Refining single item → use refine-item skill
702
+
336
703
  ## STARTUP
337
704
 
338
705
  1. Use todo_write to create a task list:
@@ -400,6 +767,16 @@ For complex features:
400
767
  description: 'Quick project outline with simple questions',
401
768
  prompt: `You are in SKETCH MODE. Ask 6 quick questions, then create backlog items.
402
769
 
770
+ ## When to Use
771
+ - Quick project kickoff
772
+ - User wants fast outline without deep dive
773
+ - Initial brainstorming session
774
+
775
+ ## When NOT to Use
776
+ - Detailed requirements needed → use design skill
777
+ - Project already has backlog → use refine skill
778
+ - Single item focus → use refine-item skill
779
+
403
780
  STEPS:
404
781
  1. Use todo_write with 6 tasks (one per question)
405
782
  2. Ask each question using ask_user_simple tool
@@ -429,6 +806,16 @@ RULES:
429
806
  description: 'Focused refinement of a specific backlog item',
430
807
  prompt: `You are in FOCUSED REFINE MODE. Your goal is to refine a specific backlog item.
431
808
 
809
+ ## When to Use
810
+ - User wants to work on a specific backlog item
811
+ - Item needs more detail or breakdown
812
+ - Changing priority of specific item
813
+
814
+ ## When NOT to Use
815
+ - Multiple items need refinement → use refine skill
816
+ - No items exist yet → use design or sketch skill
817
+ - Ready to implement → use build skill
818
+
432
819
  ## STARTUP
433
820
 
434
821
  1. Use backlog_read with id parameter to get the specific item
@@ -487,6 +874,17 @@ Based on user's choice:
487
874
  description: 'Create architecture documentation (ADRs, diagrams, data models, API designs)',
488
875
  prompt: `You are in ARCHITECTURE MODE. Your goal is to create architecture documentation.
489
876
 
877
+ ## When to Use
878
+ - Creating ADRs (Architecture Decision Records)
879
+ - Documenting system diagrams
880
+ - Designing data models or API specs
881
+ - Recording technical decisions
882
+
883
+ ## When NOT to Use
884
+ - Need product requirements → use design or prd skill
885
+ - Need to implement features → use build skill
886
+ - Just want to understand existing code → use explain skill
887
+
490
888
  ## DOCUMENT TYPE: {{doc_type}}
491
889
  {{#if custom_topic}}Custom Topic: {{custom_topic}}{{/if}}
492
890
 
@@ -621,6 +1019,16 @@ Generate appropriate documentation.
621
1019
  description: 'Amend or enhance the Product Requirements Document',
622
1020
  prompt: `You are in PRD MODE. Your goal is to update or enhance the existing Product Requirements Document.
623
1021
 
1022
+ ## When to Use
1023
+ - Updating existing PRD sections
1024
+ - Adding new requirements to PRD
1025
+ - Refining vision or scope
1026
+
1027
+ ## When NOT to Use
1028
+ - No PRD exists yet → use design skill first
1029
+ - Need architecture docs → use architecture skill
1030
+ - Need session summary → use session-notes skill
1031
+
624
1032
  ## STARTUP
625
1033
 
626
1034
  1. Use todo_write to track your progress:
@@ -693,6 +1101,16 @@ Based on section selected:
693
1101
  description: 'Create structured session notes capturing work done and decisions made',
694
1102
  prompt: `You are in SESSION NOTES MODE. Your goal is to create a structured summary of the current session.
695
1103
 
1104
+ ## When to Use
1105
+ - End of a work session
1106
+ - User asks to document what was done
1107
+ - Need to capture decisions for future reference
1108
+
1109
+ ## When NOT to Use
1110
+ - Need product requirements → use prd skill
1111
+ - Need architecture docs → use architecture skill
1112
+ - In the middle of active work
1113
+
696
1114
  ## STARTUP
697
1115
 
698
1116
  1. Use todo_write to track your progress:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/agents",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Lightweight multi-LLM agent library for building CLI AI assistants",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",