( ctx context.Context, p *Server, currentChat database.Chat, )
| 274 | } |
| 275 | |
| 276 | func buildSpawnAgentDescription( |
| 277 | ctx context.Context, |
| 278 | p *Server, |
| 279 | currentChat database.Chat, |
| 280 | ) string { |
| 281 | availableDefs := availableSubagentDefinitions(ctx, p, currentChat) |
| 282 | description := "Spawn a delegated child subagent to work on a clearly scoped, " + |
| 283 | "independent task in parallel. Use the type field to choose " + |
| 284 | "the right specialist. Available type values: " + |
| 285 | formatSubagentDefinitions(availableDefs) + ". Do not use this for " + |
| 286 | "simple or quick operations you can handle directly with execute, " + |
| 287 | "read_file, or write_file. Prefer type=\"" + subagentTypeGeneral + |
| 288 | "\" for substantial delegated research, analysis, reasoning, review, " + |
| 289 | "planning support, or implementation, even when the child should only " + |
| 290 | "report findings. When using type=\"" + subagentTypeGeneral + |
| 291 | "\" for read-only work, explicitly instruct the child not to modify " + |
| 292 | "files and to return findings. Use type=\"" + subagentTypeExplore + |
| 293 | "\" only for narrow repository-local read-only code discovery or code " + |
| 294 | "tracing, such as locating files, callsites, or a bounded existing flow. " + |
| 295 | "Do not use type=\"" + subagentTypeExplore + |
| 296 | "\" for generic research, broad architecture analysis, planning " + |
| 297 | "synthesis, external or web research, parallel research, or tasks that " + |
| 298 | "may need edits. Be careful when running parallel subagents: if two " + |
| 299 | "subagents modify the same files they will conflict with each other, " + |
| 300 | "so ensure parallel subagent tasks are independent. The child agent " + |
| 301 | "receives the same workspace tools but cannot spawn its own subagents. " + |
| 302 | "After spawning, use wait_agent to collect the result." |
| 303 | if currentChat.PlanMode.Valid && currentChat.PlanMode.ChatPlanMode == database.ChatPlanModePlan { |
| 304 | description += " During plan mode, type=\"" + subagentTypeGeneral + |
| 305 | "\" is for non-mutating substantial investigation and planning support, " + |
| 306 | "and type=\"" + subagentTypeExplore + |
| 307 | "\" is for narrow repository-local lookup or tracing. Both may use " + |
| 308 | "shell commands for exploration and inspection, but only type=\"" + |
| 309 | subagentTypeGeneral + |
| 310 | "\" should be used for cloning repositories or non-local investigation. " + |
| 311 | "They must not implement changes or intentionally modify workspace files." |
| 312 | } |
| 313 | return description |
| 314 | } |
| 315 | |
| 316 | func formatSubagentDefinitions(defs []subagentDefinition) string { |
| 317 | return formatSubagentDefinitionsWithDescriptionOverrides(defs, nil) |
no test coverage detected