@compilr-dev/sdk 0.7.24 → 0.7.25

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.
@@ -243,21 +243,31 @@ Project documents (drafts, outlines, analyses, plans) are stored in the **databa
243
243
  export const DELEGATION_MODULE = {
244
244
  id: 'delegation',
245
245
  name: 'Token Efficiency & Delegation',
246
- estimatedTokens: 200,
247
- content: `## Token Efficiency & Delegation
248
-
249
- Use the **task** tool (sub-agent) for:
250
- - **File exploration**: "find files", "what's in this directory", "explore codebase"
251
- - **Code search**: "where is X defined", "find usages of Y"
252
- - **Analysis**: "analyze module", "understand architecture", "review code"
253
- - **Multi-file operations**: Tasks touching 5+ files
254
-
255
- ### Rules
256
- 1. Exploration/search questions → task(explore)
257
- 2. Code review → task(code-review)
258
- 3. Planning → task(plan)
259
- 4. Simple answers (no file access) → respond directly
260
- 5. Code edits → do it yourself (never delegate edits)`,
246
+ estimatedTokens: 350,
247
+ content: `## CRITICAL: Subagent Delegation
248
+
249
+ The **task** tool spawns a subagent that works in isolated context and returns a summary. This is your primary tool for exploration, search, and analysis.
250
+
251
+ **Why this matters:** Reading 5 files directly costs ~25,000 tokens in YOUR context. Delegating to a subagent costs ~200 tokens (tool call + summary). The subagent sees the full content but only the summary enters your history. This 100x reduction keeps your context clean for the actual work.
252
+
253
+ ### ALWAYS delegate these:
254
+ - **File exploration**: "find files", "what's in this directory", "explore the codebase" → \`task(explore)\`
255
+ - **Code search**: "where is X defined", "find usages of Y", "how does Z work" → \`task(explore)\`
256
+ - **Analysis**: "analyze this module", "understand the architecture", "review this code" \`task(code-review)\`
257
+ - **Multi-file reads**: Any task requiring 3+ file reads \`task(explore)\`
258
+ - **Research**: web searches, documentation lookups \`task(explore)\`
259
+
260
+ ### NEVER delegate these:
261
+ - **Code edits**: Writing/editing files — do it yourself
262
+ - **Simple answers**: Questions you can answer from memory
263
+ - **User interaction**: Asking the user questions
264
+ - **Single file reads**: Reading 1-2 specific files the user pointed to
265
+
266
+ ### Examples
267
+ - User: "What files implement the auth system?" → \`task({ type: "explore", message: "Find all files related to authentication..." })\`
268
+ - User: "How does the payment module work?" → \`task({ type: "explore", message: "Analyze the payment module..." })\`
269
+ - User: "Fix the bug in login.tsx" → Read login.tsx yourself, then edit it
270
+ - User: "Add a logout button" → Read the relevant file yourself, then edit it`,
261
271
  };
262
272
  /**
263
273
  * Git safety module - only if hasGit=true
@@ -326,9 +336,9 @@ export const IMPORTANT_RULES_MODULE = {
326
336
  4. Use todo_write for multi-step tasks (3+ steps)
327
337
  5. Don't over-engineer - implement exactly what was asked
328
338
  6. Check for security issues - fix insecure code immediately
329
- 7. **DELEGATE exploration to sub-agents** - use task(explore) for file searches, code navigation, and analysis. NEVER accumulate exploration results in your own context.
330
- 8. Call suggest tool after completing tasks (don't write "suggest:" as text)
331
- 9. When user asks "what files...", "where is...", "find..." - ALWAYS use task(explore), not direct tool calls`,
339
+ 7. **DELEGATE exploration to sub-agents** - use task(explore) for searches, analysis, and multi-file reads. Each file you read directly costs thousands of tokens in YOUR context. A subagent reads files in isolation and returns a compact summary.
340
+ 8. When user asks "what files...", "where is...", "find...", "how does X work..." ALWAYS use task(explore), never read files directly to answer
341
+ 9. Call suggest tool after completing tasks (don't write "suggest:" as text)`,
332
342
  };
333
343
  /**
334
344
  * Environment module - always included
@@ -431,6 +431,7 @@ export const TOOL_PROFILES = {
431
431
  'interaction',
432
432
  'handoff',
433
433
  'guide',
434
+ 'subagents',
434
435
  'meta',
435
436
  'git_read',
436
437
  'project',
@@ -444,6 +445,7 @@ export const TOOL_PROFILES = {
444
445
  'interaction',
445
446
  'handoff',
446
447
  'guide',
448
+ 'subagents',
447
449
  'meta',
448
450
  'project',
449
451
  'search',
@@ -460,6 +462,7 @@ export const TOOL_PROFILES = {
460
462
  'interaction',
461
463
  'handoff',
462
464
  'guide',
465
+ 'subagents',
463
466
  'meta',
464
467
  'git_read',
465
468
  'git_write',
@@ -476,6 +479,7 @@ export const TOOL_PROFILES = {
476
479
  'interaction',
477
480
  'handoff',
478
481
  'guide',
482
+ 'subagents',
479
483
  'meta',
480
484
  'git_read',
481
485
  'project',
@@ -490,6 +494,7 @@ export const TOOL_PROFILES = {
490
494
  'interaction',
491
495
  'handoff',
492
496
  'guide',
497
+ 'subagents',
493
498
  'meta',
494
499
  'git_read',
495
500
  'project',
@@ -511,6 +516,7 @@ export const TOOL_PROFILES = {
511
516
  'interaction',
512
517
  'handoff',
513
518
  'guide',
519
+ 'subagents',
514
520
  'meta',
515
521
  'git_read',
516
522
  'project',
@@ -532,6 +538,7 @@ export const TOOL_PROFILES = {
532
538
  'interaction',
533
539
  'handoff',
534
540
  'guide',
541
+ 'subagents',
535
542
  'meta',
536
543
  'project',
537
544
  'backlog_read',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/sdk",
3
- "version": "0.7.24",
3
+ "version": "0.7.25",
4
4
  "description": "Universal agent runtime for building AI-powered applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",