(enabledTools: Set<string>)
| 269 | } |
| 270 | |
| 271 | function getUsingYourToolsSection(enabledTools: Set<string>): string { |
| 272 | const taskToolName = [TASK_CREATE_TOOL_NAME, TODO_WRITE_TOOL_NAME].find(n => |
| 273 | enabledTools.has(n), |
| 274 | ) |
| 275 | |
| 276 | // Ant-native builds alias find/grep to embedded bfs/ugrep and remove the |
| 277 | // dedicated Glob/Grep tools, so skip guidance pointing at them. |
| 278 | const embedded = hasEmbeddedSearchTools() |
| 279 | |
| 280 | const providedToolSubitems = [ |
| 281 | `To read files use ${FILE_READ_TOOL_NAME} instead of cat, head, tail, or sed`, |
| 282 | `To edit files use ${FILE_EDIT_TOOL_NAME} instead of sed or awk`, |
| 283 | `To create files use ${FILE_WRITE_TOOL_NAME} instead of cat with heredoc or echo redirection`, |
| 284 | `For scoped file or directory discovery, prefer the ${BASH_TOOL_NAME} tool with \`find\` or a targeted \`ls\` on a known directory`, |
| 285 | `For scoped content search, prefer the ${BASH_TOOL_NAME} tool with \`rg\``, |
| 286 | ...(embedded |
| 287 | ? [] |
| 288 | : [ |
| 289 | `Use ${GLOB_TOOL_NAME} when glob patterns are the clearest fit for path discovery`, |
| 290 | `Use ${GREP_TOOL_NAME} when its structured filters or output modes are the clearest fit for content search`, |
| 291 | ]), |
| 292 | 'Avoid broad repo-root enumeration or file-counting passes when a narrower command will do', |
| 293 | ] |
| 294 | |
| 295 | const items = [ |
| 296 | `Choose the clearest direct tool for the job. The ${BASH_TOOL_NAME} tool is the default direct path for scoped repository discovery and content search, while dedicated tools remain available when their structured interface is a better fit:`, |
| 297 | providedToolSubitems, |
| 298 | getRepoInspectionFirstTurnGuidance(embedded), |
| 299 | taskToolName |
| 300 | ? `Break down and manage your work with the ${taskToolName} tool. These tools are helpful for planning your work and helping the user track your progress. Mark each task as completed as soon as you are done with the task. Do not batch up multiple tasks before marking them as completed.` |
| 301 | : null, |
| 302 | `You can call multiple tools in a single response. If you intend to call multiple tools and there are no dependencies between them, make all independent tool calls in parallel. Maximize use of parallel tool calls where possible to increase efficiency. However, if some tool calls depend on previous calls to inform dependent values, do NOT call these tools in parallel and instead call them sequentially. For instance, if one operation must complete before another starts, run these operations sequentially instead.`, |
| 303 | ].filter(item => item !== null) |
| 304 | |
| 305 | return [`# Using your tools`, ...prependBullets(items)].join(`\n`) |
| 306 | } |
| 307 | |
| 308 | function getAgentToolSection(): string { |
| 309 | return isForkSubagentEnabled() |
no test coverage detected