@probelabs/probe 0.6.0-rc280 → 0.6.0-rc281

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.
@@ -2876,7 +2876,7 @@ ${searchToolDesc1}
2876
2876
  - searchFiles: Find files by name patterns`;
2877
2877
 
2878
2878
  if (this.enableBash) {
2879
- systemPrompt += `\n- bash: Execute bash commands for system operations`;
2879
+ systemPrompt += `\n- bash: Execute bash commands for system operations (building, running tests, git, etc.). NEVER use bash for code exploration (no grep, cat, find, head, tail) — always use search and extract tools instead, they are faster and more accurate.`;
2880
2880
  }
2881
2881
 
2882
2882
  const searchGuidance1 = this.searchDelegate
@@ -2942,7 +2942,7 @@ ${searchToolDesc2}
2942
2942
  - searchFiles: Find files by name patterns`;
2943
2943
 
2944
2944
  if (this.enableBash) {
2945
- systemPrompt += `\n- bash: Execute bash commands for system operations`;
2945
+ systemPrompt += `\n- bash: Execute bash commands for system operations (building, running tests, git, etc.). NEVER use bash for code exploration (no grep, cat, find, head, tail) — always use search and extract tools instead, they are faster and more accurate.`;
2946
2946
  }
2947
2947
 
2948
2948
  const searchGuidance2 = this.searchDelegate
@@ -3018,7 +3018,8 @@ Follow these instructions carefully:
3018
3018
  3. You should always prefer the search tool for code-related questions.${this.searchDelegate ? ' Ask natural language questions — the search subagent handles keyword formulation and returns extracted code blocks. Use extract only to expand context or read full files.' : ' Search handles stemming and case variations automatically — do NOT try keyword variations manually. Read full files only if really necessary.'}
3019
3019
  4. Ensure to get really deep and understand the full picture before answering.
3020
3020
  5. Once the task is fully completed, use the attempt_completion tool to provide the final result.
3021
- 6. ${this.searchDelegate ? 'Ask clear, specific questions when searching. Each search should target a distinct concept or question.' : 'Prefer concise and focused search queries. Use specific keywords and phrases to narrow down results.'}${this.allowEdit ? `
3021
+ 6. ${this.searchDelegate ? 'Ask clear, specific questions when searching. Each search should target a distinct concept or question.' : 'Prefer concise and focused search queries. Use specific keywords and phrases to narrow down results.'}
3022
+ 7. NEVER use bash for code exploration (no grep, cat, find, head, tail, awk, sed) — always use search and extract tools instead. Bash is only for system operations like building, running tests, or git commands.${this.allowEdit ? `
3022
3023
  7. When modifying files, choose the appropriate tool:
3023
3024
  - Use 'edit' for all code modifications:
3024
3025
  * PREFERRED: Use start_line (and optionally end_line) for line-targeted editing — this is the safest and most precise approach.${this.hashLines ? ' Use the line:hash references from extract/search output (e.g. "42:ab") for integrity verification.' : ''} Always use extract first to see line numbers${this.hashLines ? ' and hashes' : ''}, then edit by line reference.
@@ -3035,22 +3036,30 @@ Follow these instructions carefully:
3035
3036
  // Use predefined prompts from shared module (imported at top of file)
3036
3037
  let systemMessage = '';
3037
3038
 
3038
- // Use custom prompt if provided
3039
- if (this.customPrompt) {
3039
+ // Build system message from predefined prompt + optional custom prompt
3040
+ if (this.customPrompt && this.promptType && predefinedPrompts[this.promptType]) {
3041
+ // Both: use predefined as base, append custom wrapped in tag
3042
+ systemMessage = "<role>" + predefinedPrompts[this.promptType] + "</role>";
3043
+ systemMessage += commonInstructions;
3044
+ systemMessage += "\n<custom-instructions>\n" + this.customPrompt + "\n</custom-instructions>";
3045
+ if (this.debug) {
3046
+ console.log(`[DEBUG] Using predefined prompt: ${this.promptType} + custom prompt`);
3047
+ }
3048
+ } else if (this.customPrompt) {
3049
+ // Only custom prompt
3040
3050
  systemMessage = "<role>" + this.customPrompt + "</role>";
3041
3051
  if (this.debug) {
3042
3052
  console.log(`[DEBUG] Using custom prompt`);
3043
3053
  }
3044
- }
3045
- // Use predefined prompt if specified
3046
- else if (this.promptType && predefinedPrompts[this.promptType]) {
3054
+ } else if (this.promptType && predefinedPrompts[this.promptType]) {
3055
+ // Only predefined prompt
3047
3056
  systemMessage = "<role>" + predefinedPrompts[this.promptType] + "</role>";
3048
3057
  if (this.debug) {
3049
3058
  console.log(`[DEBUG] Using predefined prompt: ${this.promptType}`);
3050
3059
  }
3051
3060
  systemMessage += commonInstructions;
3052
3061
  } else {
3053
- // Use the default prompt (code explorer) if no prompt type is specified
3062
+ // Default: code explorer
3054
3063
  systemMessage = "<role>" + predefinedPrompts['code-explorer'] + "</role>";
3055
3064
  if (this.debug) {
3056
3065
  console.log(`[DEBUG] Using default prompt: code explorer`);
@@ -84097,7 +84097,7 @@ ${searchToolDesc1}
84097
84097
  - searchFiles: Find files by name patterns`;
84098
84098
  if (this.enableBash) {
84099
84099
  systemPrompt += `
84100
- - bash: Execute bash commands for system operations`;
84100
+ - bash: Execute bash commands for system operations (building, running tests, git, etc.). NEVER use bash for code exploration (no grep, cat, find, head, tail) \u2014 always use search and extract tools instead, they are faster and more accurate.`;
84101
84101
  }
84102
84102
  const searchGuidance1 = this.searchDelegate ? "1. Start with search \u2014 ask a question about what you want to understand. It returns extracted code blocks directly." : "1. Start with search to find relevant code patterns. One search per concept is usually enough \u2014 probe handles stemming and case variations.";
84103
84103
  const extractGuidance1 = this.searchDelegate ? "2. Use extract only if you need more context or a full file" : "2. Use extract to get detailed context when needed";
@@ -84152,7 +84152,7 @@ ${searchToolDesc2}
84152
84152
  - searchFiles: Find files by name patterns`;
84153
84153
  if (this.enableBash) {
84154
84154
  systemPrompt += `
84155
- - bash: Execute bash commands for system operations`;
84155
+ - bash: Execute bash commands for system operations (building, running tests, git, etc.). NEVER use bash for code exploration (no grep, cat, find, head, tail) \u2014 always use search and extract tools instead, they are faster and more accurate.`;
84156
84156
  }
84157
84157
  const searchGuidance2 = this.searchDelegate ? "1. Start with search \u2014 ask a question about what you want to understand. It returns extracted code blocks directly." : "1. Start with search to find relevant code patterns. One search per concept is usually enough \u2014 probe handles stemming and case variations.";
84158
84158
  const extractGuidance2 = this.searchDelegate ? "2. Use extract only if you need more context or a full file" : "2. Use extract to get detailed context when needed";
@@ -84218,7 +84218,8 @@ Follow these instructions carefully:
84218
84218
  3. You should always prefer the search tool for code-related questions.${this.searchDelegate ? " Ask natural language questions \u2014 the search subagent handles keyword formulation and returns extracted code blocks. Use extract only to expand context or read full files." : " Search handles stemming and case variations automatically \u2014 do NOT try keyword variations manually. Read full files only if really necessary."}
84219
84219
  4. Ensure to get really deep and understand the full picture before answering.
84220
84220
  5. Once the task is fully completed, use the attempt_completion tool to provide the final result.
84221
- 6. ${this.searchDelegate ? "Ask clear, specific questions when searching. Each search should target a distinct concept or question." : "Prefer concise and focused search queries. Use specific keywords and phrases to narrow down results."}${this.allowEdit ? `
84221
+ 6. ${this.searchDelegate ? "Ask clear, specific questions when searching. Each search should target a distinct concept or question." : "Prefer concise and focused search queries. Use specific keywords and phrases to narrow down results."}
84222
+ 7. NEVER use bash for code exploration (no grep, cat, find, head, tail, awk, sed) \u2014 always use search and extract tools instead. Bash is only for system operations like building, running tests, or git commands.${this.allowEdit ? `
84222
84223
  7. When modifying files, choose the appropriate tool:
84223
84224
  - Use 'edit' for all code modifications:
84224
84225
  * PREFERRED: Use start_line (and optionally end_line) for line-targeted editing \u2014 this is the safest and most precise approach.${this.hashLines ? ' Use the line:hash references from extract/search output (e.g. "42:ab") for integrity verification.' : ""} Always use extract first to see line numbers${this.hashLines ? " and hashes" : ""}, then edit by line reference.
@@ -84232,7 +84233,14 @@ Follow these instructions carefully:
84232
84233
  </instructions>
84233
84234
  `;
84234
84235
  let systemMessage = "";
84235
- if (this.customPrompt) {
84236
+ if (this.customPrompt && this.promptType && predefinedPrompts[this.promptType]) {
84237
+ systemMessage = "<role>" + predefinedPrompts[this.promptType] + "</role>";
84238
+ systemMessage += commonInstructions;
84239
+ systemMessage += "\n<custom-instructions>\n" + this.customPrompt + "\n</custom-instructions>";
84240
+ if (this.debug) {
84241
+ console.log(`[DEBUG] Using predefined prompt: ${this.promptType} + custom prompt`);
84242
+ }
84243
+ } else if (this.customPrompt) {
84236
84244
  systemMessage = "<role>" + this.customPrompt + "</role>";
84237
84245
  if (this.debug) {
84238
84246
  console.log(`[DEBUG] Using custom prompt`);
@@ -154,7 +154,7 @@ export const searchDelegateDescription = 'Search code in the repository by askin
154
154
  export const queryDescription = 'Search code using ast-grep structural pattern matching. Use this tool to find specific code structures like functions, classes, or methods.';
155
155
  export const extractDescription = 'Extract code blocks from files based on file paths and optional line numbers. Use this tool to see complete context after finding relevant files. Line numbers from output can be used with edit start_line/end_line for precise editing.';
156
156
  export const delegateDescription = 'Automatically delegate big distinct tasks to specialized probe subagents within the agentic loop. Used by AI agents to break down complex requests into focused, parallel tasks.';
157
- export const bashDescription = 'Execute bash commands for system exploration and development tasks. Secure by default with built-in allow/deny lists.';
157
+ export const bashDescription = 'Execute bash commands for system operations: building, running tests, git, package management, etc. NEVER use for code exploration (no grep, cat, find, head, tail) — use search and extract tools instead. Secure by default with built-in allow/deny lists.';
158
158
  export const analyzeAllDescription = 'Answer questions that require analyzing ALL matching data in the codebase. Use for aggregate questions like "What features exist?", "List all API endpoints", "Count TODO comments". The AI automatically plans the search strategy, processes all results via map-reduce, and synthesizes a comprehensive answer. WARNING: Slower than search - only use when you need complete coverage.';
159
159
 
160
160
 
@@ -111043,7 +111043,7 @@ ${searchToolDesc1}
111043
111043
  - searchFiles: Find files by name patterns`;
111044
111044
  if (this.enableBash) {
111045
111045
  systemPrompt += `
111046
- - bash: Execute bash commands for system operations`;
111046
+ - bash: Execute bash commands for system operations (building, running tests, git, etc.). NEVER use bash for code exploration (no grep, cat, find, head, tail) \u2014 always use search and extract tools instead, they are faster and more accurate.`;
111047
111047
  }
111048
111048
  const searchGuidance1 = this.searchDelegate ? "1. Start with search \u2014 ask a question about what you want to understand. It returns extracted code blocks directly." : "1. Start with search to find relevant code patterns. One search per concept is usually enough \u2014 probe handles stemming and case variations.";
111049
111049
  const extractGuidance1 = this.searchDelegate ? "2. Use extract only if you need more context or a full file" : "2. Use extract to get detailed context when needed";
@@ -111098,7 +111098,7 @@ ${searchToolDesc2}
111098
111098
  - searchFiles: Find files by name patterns`;
111099
111099
  if (this.enableBash) {
111100
111100
  systemPrompt += `
111101
- - bash: Execute bash commands for system operations`;
111101
+ - bash: Execute bash commands for system operations (building, running tests, git, etc.). NEVER use bash for code exploration (no grep, cat, find, head, tail) \u2014 always use search and extract tools instead, they are faster and more accurate.`;
111102
111102
  }
111103
111103
  const searchGuidance2 = this.searchDelegate ? "1. Start with search \u2014 ask a question about what you want to understand. It returns extracted code blocks directly." : "1. Start with search to find relevant code patterns. One search per concept is usually enough \u2014 probe handles stemming and case variations.";
111104
111104
  const extractGuidance2 = this.searchDelegate ? "2. Use extract only if you need more context or a full file" : "2. Use extract to get detailed context when needed";
@@ -111164,7 +111164,8 @@ Follow these instructions carefully:
111164
111164
  3. You should always prefer the search tool for code-related questions.${this.searchDelegate ? " Ask natural language questions \u2014 the search subagent handles keyword formulation and returns extracted code blocks. Use extract only to expand context or read full files." : " Search handles stemming and case variations automatically \u2014 do NOT try keyword variations manually. Read full files only if really necessary."}
111165
111165
  4. Ensure to get really deep and understand the full picture before answering.
111166
111166
  5. Once the task is fully completed, use the attempt_completion tool to provide the final result.
111167
- 6. ${this.searchDelegate ? "Ask clear, specific questions when searching. Each search should target a distinct concept or question." : "Prefer concise and focused search queries. Use specific keywords and phrases to narrow down results."}${this.allowEdit ? `
111167
+ 6. ${this.searchDelegate ? "Ask clear, specific questions when searching. Each search should target a distinct concept or question." : "Prefer concise and focused search queries. Use specific keywords and phrases to narrow down results."}
111168
+ 7. NEVER use bash for code exploration (no grep, cat, find, head, tail, awk, sed) \u2014 always use search and extract tools instead. Bash is only for system operations like building, running tests, or git commands.${this.allowEdit ? `
111168
111169
  7. When modifying files, choose the appropriate tool:
111169
111170
  - Use 'edit' for all code modifications:
111170
111171
  * PREFERRED: Use start_line (and optionally end_line) for line-targeted editing \u2014 this is the safest and most precise approach.${this.hashLines ? ' Use the line:hash references from extract/search output (e.g. "42:ab") for integrity verification.' : ""} Always use extract first to see line numbers${this.hashLines ? " and hashes" : ""}, then edit by line reference.
@@ -111178,7 +111179,14 @@ Follow these instructions carefully:
111178
111179
  </instructions>
111179
111180
  `;
111180
111181
  let systemMessage = "";
111181
- if (this.customPrompt) {
111182
+ if (this.customPrompt && this.promptType && predefinedPrompts[this.promptType]) {
111183
+ systemMessage = "<role>" + predefinedPrompts[this.promptType] + "</role>";
111184
+ systemMessage += commonInstructions;
111185
+ systemMessage += "\n<custom-instructions>\n" + this.customPrompt + "\n</custom-instructions>";
111186
+ if (this.debug) {
111187
+ console.log(`[DEBUG] Using predefined prompt: ${this.promptType} + custom prompt`);
111188
+ }
111189
+ } else if (this.customPrompt) {
111182
111190
  systemMessage = "<role>" + this.customPrompt + "</role>";
111183
111191
  if (this.debug) {
111184
111192
  console.log(`[DEBUG] Using custom prompt`);
package/cjs/index.cjs CHANGED
@@ -36422,7 +36422,7 @@ var init_common2 = __esm({
36422
36422
  queryDescription = "Search code using ast-grep structural pattern matching. Use this tool to find specific code structures like functions, classes, or methods.";
36423
36423
  extractDescription = "Extract code blocks from files based on file paths and optional line numbers. Use this tool to see complete context after finding relevant files. Line numbers from output can be used with edit start_line/end_line for precise editing.";
36424
36424
  delegateDescription = "Automatically delegate big distinct tasks to specialized probe subagents within the agentic loop. Used by AI agents to break down complex requests into focused, parallel tasks.";
36425
- bashDescription = "Execute bash commands for system exploration and development tasks. Secure by default with built-in allow/deny lists.";
36425
+ bashDescription = "Execute bash commands for system operations: building, running tests, git, package management, etc. NEVER use for code exploration (no grep, cat, find, head, tail) \u2014 use search and extract tools instead. Secure by default with built-in allow/deny lists.";
36426
36426
  analyzeAllDescription = 'Answer questions that require analyzing ALL matching data in the codebase. Use for aggregate questions like "What features exist?", "List all API endpoints", "Count TODO comments". The AI automatically plans the search strategy, processes all results via map-reduce, and synthesizes a comprehensive answer. WARNING: Slower than search - only use when you need complete coverage.';
36427
36427
  }
36428
36428
  });
@@ -108200,7 +108200,7 @@ ${searchToolDesc1}
108200
108200
  - searchFiles: Find files by name patterns`;
108201
108201
  if (this.enableBash) {
108202
108202
  systemPrompt += `
108203
- - bash: Execute bash commands for system operations`;
108203
+ - bash: Execute bash commands for system operations (building, running tests, git, etc.). NEVER use bash for code exploration (no grep, cat, find, head, tail) \u2014 always use search and extract tools instead, they are faster and more accurate.`;
108204
108204
  }
108205
108205
  const searchGuidance1 = this.searchDelegate ? "1. Start with search \u2014 ask a question about what you want to understand. It returns extracted code blocks directly." : "1. Start with search to find relevant code patterns. One search per concept is usually enough \u2014 probe handles stemming and case variations.";
108206
108206
  const extractGuidance1 = this.searchDelegate ? "2. Use extract only if you need more context or a full file" : "2. Use extract to get detailed context when needed";
@@ -108255,7 +108255,7 @@ ${searchToolDesc2}
108255
108255
  - searchFiles: Find files by name patterns`;
108256
108256
  if (this.enableBash) {
108257
108257
  systemPrompt += `
108258
- - bash: Execute bash commands for system operations`;
108258
+ - bash: Execute bash commands for system operations (building, running tests, git, etc.). NEVER use bash for code exploration (no grep, cat, find, head, tail) \u2014 always use search and extract tools instead, they are faster and more accurate.`;
108259
108259
  }
108260
108260
  const searchGuidance2 = this.searchDelegate ? "1. Start with search \u2014 ask a question about what you want to understand. It returns extracted code blocks directly." : "1. Start with search to find relevant code patterns. One search per concept is usually enough \u2014 probe handles stemming and case variations.";
108261
108261
  const extractGuidance2 = this.searchDelegate ? "2. Use extract only if you need more context or a full file" : "2. Use extract to get detailed context when needed";
@@ -108321,7 +108321,8 @@ Follow these instructions carefully:
108321
108321
  3. You should always prefer the search tool for code-related questions.${this.searchDelegate ? " Ask natural language questions \u2014 the search subagent handles keyword formulation and returns extracted code blocks. Use extract only to expand context or read full files." : " Search handles stemming and case variations automatically \u2014 do NOT try keyword variations manually. Read full files only if really necessary."}
108322
108322
  4. Ensure to get really deep and understand the full picture before answering.
108323
108323
  5. Once the task is fully completed, use the attempt_completion tool to provide the final result.
108324
- 6. ${this.searchDelegate ? "Ask clear, specific questions when searching. Each search should target a distinct concept or question." : "Prefer concise and focused search queries. Use specific keywords and phrases to narrow down results."}${this.allowEdit ? `
108324
+ 6. ${this.searchDelegate ? "Ask clear, specific questions when searching. Each search should target a distinct concept or question." : "Prefer concise and focused search queries. Use specific keywords and phrases to narrow down results."}
108325
+ 7. NEVER use bash for code exploration (no grep, cat, find, head, tail, awk, sed) \u2014 always use search and extract tools instead. Bash is only for system operations like building, running tests, or git commands.${this.allowEdit ? `
108325
108326
  7. When modifying files, choose the appropriate tool:
108326
108327
  - Use 'edit' for all code modifications:
108327
108328
  * PREFERRED: Use start_line (and optionally end_line) for line-targeted editing \u2014 this is the safest and most precise approach.${this.hashLines ? ' Use the line:hash references from extract/search output (e.g. "42:ab") for integrity verification.' : ""} Always use extract first to see line numbers${this.hashLines ? " and hashes" : ""}, then edit by line reference.
@@ -108335,7 +108336,14 @@ Follow these instructions carefully:
108335
108336
  </instructions>
108336
108337
  `;
108337
108338
  let systemMessage = "";
108338
- if (this.customPrompt) {
108339
+ if (this.customPrompt && this.promptType && predefinedPrompts[this.promptType]) {
108340
+ systemMessage = "<role>" + predefinedPrompts[this.promptType] + "</role>";
108341
+ systemMessage += commonInstructions;
108342
+ systemMessage += "\n<custom-instructions>\n" + this.customPrompt + "\n</custom-instructions>";
108343
+ if (this.debug) {
108344
+ console.log(`[DEBUG] Using predefined prompt: ${this.promptType} + custom prompt`);
108345
+ }
108346
+ } else if (this.customPrompt) {
108339
108347
  systemMessage = "<role>" + this.customPrompt + "</role>";
108340
108348
  if (this.debug) {
108341
108349
  console.log(`[DEBUG] Using custom prompt`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@probelabs/probe",
3
- "version": "0.6.0-rc280",
3
+ "version": "0.6.0-rc281",
4
4
  "description": "Node.js wrapper for the probe code search tool",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -2876,7 +2876,7 @@ ${searchToolDesc1}
2876
2876
  - searchFiles: Find files by name patterns`;
2877
2877
 
2878
2878
  if (this.enableBash) {
2879
- systemPrompt += `\n- bash: Execute bash commands for system operations`;
2879
+ systemPrompt += `\n- bash: Execute bash commands for system operations (building, running tests, git, etc.). NEVER use bash for code exploration (no grep, cat, find, head, tail) — always use search and extract tools instead, they are faster and more accurate.`;
2880
2880
  }
2881
2881
 
2882
2882
  const searchGuidance1 = this.searchDelegate
@@ -2942,7 +2942,7 @@ ${searchToolDesc2}
2942
2942
  - searchFiles: Find files by name patterns`;
2943
2943
 
2944
2944
  if (this.enableBash) {
2945
- systemPrompt += `\n- bash: Execute bash commands for system operations`;
2945
+ systemPrompt += `\n- bash: Execute bash commands for system operations (building, running tests, git, etc.). NEVER use bash for code exploration (no grep, cat, find, head, tail) — always use search and extract tools instead, they are faster and more accurate.`;
2946
2946
  }
2947
2947
 
2948
2948
  const searchGuidance2 = this.searchDelegate
@@ -3018,7 +3018,8 @@ Follow these instructions carefully:
3018
3018
  3. You should always prefer the search tool for code-related questions.${this.searchDelegate ? ' Ask natural language questions — the search subagent handles keyword formulation and returns extracted code blocks. Use extract only to expand context or read full files.' : ' Search handles stemming and case variations automatically — do NOT try keyword variations manually. Read full files only if really necessary.'}
3019
3019
  4. Ensure to get really deep and understand the full picture before answering.
3020
3020
  5. Once the task is fully completed, use the attempt_completion tool to provide the final result.
3021
- 6. ${this.searchDelegate ? 'Ask clear, specific questions when searching. Each search should target a distinct concept or question.' : 'Prefer concise and focused search queries. Use specific keywords and phrases to narrow down results.'}${this.allowEdit ? `
3021
+ 6. ${this.searchDelegate ? 'Ask clear, specific questions when searching. Each search should target a distinct concept or question.' : 'Prefer concise and focused search queries. Use specific keywords and phrases to narrow down results.'}
3022
+ 7. NEVER use bash for code exploration (no grep, cat, find, head, tail, awk, sed) — always use search and extract tools instead. Bash is only for system operations like building, running tests, or git commands.${this.allowEdit ? `
3022
3023
  7. When modifying files, choose the appropriate tool:
3023
3024
  - Use 'edit' for all code modifications:
3024
3025
  * PREFERRED: Use start_line (and optionally end_line) for line-targeted editing — this is the safest and most precise approach.${this.hashLines ? ' Use the line:hash references from extract/search output (e.g. "42:ab") for integrity verification.' : ''} Always use extract first to see line numbers${this.hashLines ? ' and hashes' : ''}, then edit by line reference.
@@ -3035,22 +3036,30 @@ Follow these instructions carefully:
3035
3036
  // Use predefined prompts from shared module (imported at top of file)
3036
3037
  let systemMessage = '';
3037
3038
 
3038
- // Use custom prompt if provided
3039
- if (this.customPrompt) {
3039
+ // Build system message from predefined prompt + optional custom prompt
3040
+ if (this.customPrompt && this.promptType && predefinedPrompts[this.promptType]) {
3041
+ // Both: use predefined as base, append custom wrapped in tag
3042
+ systemMessage = "<role>" + predefinedPrompts[this.promptType] + "</role>";
3043
+ systemMessage += commonInstructions;
3044
+ systemMessage += "\n<custom-instructions>\n" + this.customPrompt + "\n</custom-instructions>";
3045
+ if (this.debug) {
3046
+ console.log(`[DEBUG] Using predefined prompt: ${this.promptType} + custom prompt`);
3047
+ }
3048
+ } else if (this.customPrompt) {
3049
+ // Only custom prompt
3040
3050
  systemMessage = "<role>" + this.customPrompt + "</role>";
3041
3051
  if (this.debug) {
3042
3052
  console.log(`[DEBUG] Using custom prompt`);
3043
3053
  }
3044
- }
3045
- // Use predefined prompt if specified
3046
- else if (this.promptType && predefinedPrompts[this.promptType]) {
3054
+ } else if (this.promptType && predefinedPrompts[this.promptType]) {
3055
+ // Only predefined prompt
3047
3056
  systemMessage = "<role>" + predefinedPrompts[this.promptType] + "</role>";
3048
3057
  if (this.debug) {
3049
3058
  console.log(`[DEBUG] Using predefined prompt: ${this.promptType}`);
3050
3059
  }
3051
3060
  systemMessage += commonInstructions;
3052
3061
  } else {
3053
- // Use the default prompt (code explorer) if no prompt type is specified
3062
+ // Default: code explorer
3054
3063
  systemMessage = "<role>" + predefinedPrompts['code-explorer'] + "</role>";
3055
3064
  if (this.debug) {
3056
3065
  console.log(`[DEBUG] Using default prompt: code explorer`);
@@ -154,7 +154,7 @@ export const searchDelegateDescription = 'Search code in the repository by askin
154
154
  export const queryDescription = 'Search code using ast-grep structural pattern matching. Use this tool to find specific code structures like functions, classes, or methods.';
155
155
  export const extractDescription = 'Extract code blocks from files based on file paths and optional line numbers. Use this tool to see complete context after finding relevant files. Line numbers from output can be used with edit start_line/end_line for precise editing.';
156
156
  export const delegateDescription = 'Automatically delegate big distinct tasks to specialized probe subagents within the agentic loop. Used by AI agents to break down complex requests into focused, parallel tasks.';
157
- export const bashDescription = 'Execute bash commands for system exploration and development tasks. Secure by default with built-in allow/deny lists.';
157
+ export const bashDescription = 'Execute bash commands for system operations: building, running tests, git, package management, etc. NEVER use for code exploration (no grep, cat, find, head, tail) — use search and extract tools instead. Secure by default with built-in allow/deny lists.';
158
158
  export const analyzeAllDescription = 'Answer questions that require analyzing ALL matching data in the codebase. Use for aggregate questions like "What features exist?", "List all API endpoints", "Count TODO comments". The AI automatically plans the search strategy, processes all results via map-reduce, and synthesizes a comprehensive answer. WARNING: Slower than search - only use when you need complete coverage.';
159
159
 
160
160