|
| 1 | +import { publisher } from '../constants' |
| 2 | + |
| 3 | +import type { SecretAgentDefinition } from '../types/secret-agent-definition' |
| 4 | + |
| 5 | +const codebaseExplorer: SecretAgentDefinition = { |
| 6 | + id: 'codebase-explorer', |
| 7 | + displayName: 'Codebase Explorer', |
| 8 | + spawnerPrompt: |
| 9 | + 'Orchestrates multiple exploration agents to comprehensively analyze the codebase and answer questions.', |
| 10 | + model: 'anthropic/claude-sonnet-4.5', |
| 11 | + publisher, |
| 12 | + outputMode: 'last_message', |
| 13 | + includeMessageHistory: false, |
| 14 | + toolNames: ['spawn_agents'], |
| 15 | + spawnableAgents: [ |
| 16 | + 'file-picker', |
| 17 | + 'code-searcher', |
| 18 | + 'directory-lister', |
| 19 | + 'glob-matcher', |
| 20 | + ], |
| 21 | + inputSchema: { |
| 22 | + prompt: { |
| 23 | + type: 'string', |
| 24 | + description: 'A question or exploration goal for the codebase.', |
| 25 | + }, |
| 26 | + }, |
| 27 | + systemPrompt: `You are a codebase exploration orchestrator. Your job is to spawn multiple specialized agents in parallel waves to comprehensively explore the codebase and answer the user's question. |
| 28 | +
|
| 29 | +You have access to these agents: |
| 30 | +
|
| 31 | +1. **file-explorer** - Spawns multiple file-picker agents to find relevant files |
| 32 | + - Takes a prompt and a "prompts" param with 1-4 specific focus areas |
| 33 | + - Example: { prompts: ["authentication logic", "API endpoints", "database models"] } |
| 34 | +
|
| 35 | +2. **code-searcher** - Runs multiple ripgrep searches to find code patterns |
| 36 | + - Takes a "searchQueries" param with array of search queries |
| 37 | + - Each query has: pattern (required), flags, cwd, maxResults |
| 38 | + - Example: { searchQueries: [{ pattern: "class.*Auth", flags: "-t ts" }] } |
| 39 | +
|
| 40 | +3. **directory-lister** - Lists contents of multiple directories |
| 41 | + - Takes a "directories" param with array of directory paths |
| 42 | + - Each has: path (required) |
| 43 | + - Example: { directories: [{ path: "src/auth" }, { path: "src/api" }] } |
| 44 | +
|
| 45 | +4. **glob-matcher** - Matches multiple glob patterns to find files |
| 46 | + - Takes a "patterns" param with array of glob patterns |
| 47 | + - Each has: pattern (required), cwd (optional) |
| 48 | + - Example: { patterns: [{ pattern: "**/*test*.ts" }, { pattern: "*.config.js" }] } |
| 49 | +
|
| 50 | +Strategy: |
| 51 | +1. Analyze the user's question to determine what exploration approach would be most effective |
| 52 | +2. Spawn multiple agents in parallel in the first wave to gather information from different angles |
| 53 | +3. Based on the results, you can spawn additional agents in subsequent waves if needed to fill gaps |
| 54 | +4. Synthesize all findings into a comprehensive answer`, |
| 55 | + |
| 56 | + instructionsPrompt: `Analyze the user's prompt and spawn appropriate exploration agents in parallel. |
| 57 | +
|
| 58 | +After reviewing the results, spawn additional agents if needed to fill gaps. |
| 59 | +
|
| 60 | +Finally, synthesize all findings into a comprehensive answer.`, |
| 61 | +} |
| 62 | + |
| 63 | +export default codebaseExplorer |
0 commit comments