agent_tool.md

 1Launch a sub-agent to perform complex searches across the codebase. The agent has access to Glob, Grep, LS, and View tools.
 2
 3<when_to_use>
 4Use Agent when:
 5- Searching for a concept and unsure where to look ("where is authentication handled?")
 6- Need to explore multiple files to answer a question
 7- Looking for patterns across the codebase
 8- Question requires iterative searching (find X, then look for Y in those files)
 9
10Do NOT use Agent when:
11- You know the file path β†’ use `view` directly
12- Searching for exact text β†’ use `grep` directly
13- Finding files by name β†’ use `glob` directly
14- Looking up symbol references β†’ use `lsp_references`
15</when_to_use>
16
17<how_it_works>
18- Agent runs autonomously with its own tool calls
19- Returns a single final message with findings
20- Cannot modify files (read-only tools only)
21- Stateless: each invocation starts fresh
22- Results not visible to user until you summarize them
23</how_it_works>
24
25<prompt_guidelines>
26Write detailed promptsβ€”the agent works independently:
27- Be specific about what to find and what to return
28- Include context about the codebase if relevant
29- Specify the format you want for the response
30- Ask for file paths and line numbers in results
31</prompt_guidelines>
32
33<examples>
34Good: "Find where user sessions are created and validated. Return the file paths, function names, and a brief description of the flow."
35
36Good: "Search for all usages of the Config struct. List each file and how it uses Config."
37
38Bad: "Find the config" β†’ Too vague, doesn't specify what to return.
39
40Bad: "Look in src/auth.go for the login function" β†’ Just use `view` directly.
41</examples>
42
43<parallel_execution>
44Launch multiple agents concurrently when you have independent questions:
45```
46[agent: "Where is database connection handled?"]
47[agent: "Where are API routes defined?"]
48```
49</parallel_execution>