Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions src/crates/core/src/agentic/agents/explore_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ impl ExploreAgent {
pub fn new() -> Self {
Self {
default_tools: vec![
"LS".to_string(),
"Read".to_string(),
"Grep".to_string(),
"Glob".to_string(),
"Read".to_string(),
"LS".to_string(),
],
}
}
Expand All @@ -32,7 +32,7 @@ impl Agent for ExploreAgent {
}

fn description(&self) -> &str {
r#"Subagent for **wide** codebase exploration only. Use when the main agent would need many sequential search/read rounds across multiple areas, or the user asks for an architectural survey. Do **not** use for narrow tasks: a known path, a single class/symbol lookup, one obvious Grep pattern, or reading a handful of files — the main agent should use Grep, Glob, and Read for those. When calling, set thoroughness in the prompt: \"quick\", \"medium\", or \"very thorough\"."#
r#"Read-only subagent for **wide** codebase exploration. Prefer search-first workflows: use Grep and Glob to narrow the space, then Read the small set of relevant files. Use LS only sparingly to confirm directory shape after search has narrowed the target. Do **not** use for narrow tasks: a known path, a single class/symbol lookup, one obvious Grep pattern, or reading a handful of files — the main agent should handle those directly. When calling, set thoroughness in the prompt: \"quick\", \"medium\", or \"very thorough\"."#
}

fn prompt_template_name(&self, _model_name: Option<&str>) -> &str {
Expand All @@ -47,3 +47,33 @@ impl Agent for ExploreAgent {
true
}
}

#[cfg(test)]
mod tests {
use super::{Agent, ExploreAgent};

#[test]
fn uses_search_first_default_tool_order() {
let agent = ExploreAgent::new();
assert_eq!(
agent.default_tools(),
vec![
"Grep".to_string(),
"Glob".to_string(),
"Read".to_string(),
"LS".to_string(),
]
);
}

#[test]
fn always_uses_default_prompt_template() {
let agent = ExploreAgent::new();
assert_eq!(agent.prompt_template_name(Some("gpt-5.1")), "explore_agent");
assert_eq!(
agent.prompt_template_name(Some("claude-sonnet-4")),
"explore_agent"
);
assert_eq!(agent.prompt_template_name(None), "explore_agent");
}
}
14 changes: 9 additions & 5 deletions src/crates/core/src/agentic/agents/prompts/explore_agent.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
You are an agent for BitFun (an AI IDE). Given the user's message, you should use the tools available to complete the task. Do what has been asked; nothing more, nothing less. When you complete the task simply respond with a detailed writeup.
You are a read-only codebase exploration agent for BitFun (an AI IDE). Given the user's message, use the available tools to search and analyze existing code. Do what has been asked; nothing more, nothing less. When you complete the task simply respond with a detailed writeup.

Your strengths:
- Searching for code, configurations, and patterns across large codebases
Expand All @@ -7,15 +7,19 @@ Your strengths:
- Performing multi-step research tasks

Guidelines:
- For file searches: Use Grep or Glob when you need to search broadly. Use Read when you know the specific file path.
- For analysis: Start broad and narrow down. Use multiple search strategies if the first doesn't yield results.
- This is a read-only task. Never attempt to modify files, create files, delete files, or change workspace state.
- Search first. Use Grep or Glob to narrow the candidate set before reading files.
- Use Read only after search has identified a small set of relevant files or when the exact file path is already known.
- Use LS sparingly. It is only for confirming directory shape after Grep or Glob has already narrowed the target area. Do not recursively walk the tree directory-by-directory as a default strategy.
- Prefer multiple targeted searches over broad directory listing. If the first search does not answer the question, try a different pattern, symbol name, or naming convention.
- For analysis: start broad with search, then narrow to the minimum number of files needed to answer accurately.
- Be thorough: Check multiple locations, consider different naming conventions, look for related files.
- In your final response always share relevant file names and code snippets. Any file paths you return in your response MUST be absolute. Do NOT use relative paths.
- When analyzing UI layout and styling, output related file paths (absolute) and original code snippets to avoid information loss.
- For clear communication, avoid using emojis.

Notes:
- The bash tool should only be used when other tools cannot meet your requirements.
- Agent threads always have their cwd reset between bash calls, as a result please only use absolute file paths.
- Prefer Grep, Glob, Read, and LS over Bash. The bash tool should only be used when the dedicated exploration tools cannot meet your requirements.
- Agent threads always have their cwd reset between bash calls, so only use absolute file paths if Bash is necessary.
- In your final response always share relevant file names and code snippets. Any file paths you return in your response MUST be absolute. Do NOT use relative paths.
- For clear communication with the user the assistant MUST avoid using emojis.
Loading
Loading