Skip to content

Commit f4e0984

Browse files
committed
create codebase explorer, directory-lister, glob-matcher. consolidate file-pickers
1 parent f84d63b commit f4e0984

File tree

11 files changed

+184
-41
lines changed

11 files changed

+184
-41
lines changed

.agents/base2/base-layer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const definition: SecretAgentDefinition = {
3232
spawnableAgents: [
3333
'read-only-commander',
3434
'file-picker',
35-
'code-searcher',
35+
'codebase-explorer',
3636
'researcher-web',
3737
'researcher-docs',
3838
'thinker',

.agents/file-explorer/code-searcher.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const codeSearcher: SecretAgentDefinition = {
3434
id: 'code-searcher',
3535
displayName: 'Code Searcher',
3636
spawnerPrompt:
37-
'Mechanically runs multiple code search queries and returns all results',
37+
'Mechanically runs multiple code search queries (using ripgrep line-oriented search) and returns all results',
3838
model: 'anthropic/claude-sonnet-4.5',
3939
publisher,
4040
outputMode: 'all_messages',
@@ -44,16 +44,6 @@ const codeSearcher: SecretAgentDefinition = {
4444
inputSchema: {
4545
params: paramsSchema,
4646
},
47-
systemPrompt:
48-
'You are a code searcher agent that executes multiple code search queries and compiles the results. Your goal is to systematically search the codebase using the provided patterns and report all findings.',
49-
instructionsPrompt: `
50-
Execute each code search query provided in the parameters and compile all results.
51-
52-
For each search query, run the code_search tool with the specified pattern, flags, cwd, and maxResults.
53-
54-
After all searches complete, provide a comprehensive summary of the findings, organizing results by search query.
55-
`.trim(),
56-
5747
handleSteps: function* ({ params }) {
5848
const searchQueries: SearchQuery[] = params?.searchQueries ?? []
5949

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { publisher } from '../constants'
2+
3+
import type { SecretAgentDefinition } from '../types/secret-agent-definition'
4+
5+
interface ListDirectoryQuery {
6+
path: string
7+
}
8+
9+
const paramsSchema = {
10+
type: 'object' as const,
11+
properties: {
12+
directories: {
13+
type: 'array' as const,
14+
items: {
15+
type: 'object' as const,
16+
properties: {
17+
path: { type: 'string' as const },
18+
},
19+
required: ['path'],
20+
},
21+
description: 'Array of directory paths to list',
22+
},
23+
},
24+
required: ['directories'],
25+
}
26+
27+
const directoryLister: SecretAgentDefinition = {
28+
id: 'directory-lister',
29+
displayName: 'Directory Lister',
30+
spawnerPrompt:
31+
'Mechanically lists multiple directories and returns their contents',
32+
model: 'anthropic/claude-sonnet-4.5',
33+
publisher,
34+
outputMode: 'all_messages',
35+
includeMessageHistory: false,
36+
toolNames: ['list_directory'],
37+
spawnableAgents: [],
38+
inputSchema: {
39+
params: paramsSchema,
40+
},
41+
handleSteps: function* ({ params }) {
42+
const directories: ListDirectoryQuery[] = params?.directories ?? []
43+
44+
for (const directory of directories) {
45+
yield {
46+
toolName: 'list_directory',
47+
input: {
48+
path: directory.path,
49+
},
50+
}
51+
}
52+
},
53+
}
54+
55+
export default directoryLister

.agents/file-explorer/file-explorer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const fileExplorer: SecretAgentDefinition = {
2222
displayName: 'Dora the File Explorer',
2323
spawnerPrompt:
2424
'Comprehensively explores the codebase and reports back on the results',
25-
model: 'anthropic/claude-4-sonnet-20250522',
25+
model: 'x-ai/grok-4-fast',
2626
publisher,
2727
outputMode: 'structured_output',
2828
includeMessageHistory: false,

.agents/file-explorer/file-picker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { SecretAgentDefinition } from '../types/secret-agent-definition'
66
const definition: SecretAgentDefinition = {
77
id: 'file-picker',
88
publisher,
9-
...filePicker('google/gemini-2.5-flash'),
9+
...filePicker('x-ai/grok-4-fast'),
1010
}
1111

1212
export default definition
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import { publisher } from '../constants'
2+
3+
import type { SecretAgentDefinition } from '../types/secret-agent-definition'
4+
5+
interface GlobQuery {
6+
pattern: string
7+
cwd?: string
8+
}
9+
10+
const paramsSchema = {
11+
type: 'object' as const,
12+
properties: {
13+
patterns: {
14+
type: 'array' as const,
15+
items: {
16+
type: 'object' as const,
17+
properties: {
18+
pattern: { type: 'string' as const },
19+
cwd: { type: 'string' as const },
20+
},
21+
required: ['pattern'],
22+
},
23+
description: 'Array of glob patterns to match',
24+
},
25+
},
26+
required: ['patterns'],
27+
}
28+
29+
const globMatcher: SecretAgentDefinition = {
30+
id: 'glob-matcher',
31+
displayName: 'Glob Matcher',
32+
spawnerPrompt:
33+
'Mechanically runs multiple glob pattern matches and returns all matching files',
34+
model: 'anthropic/claude-sonnet-4.5',
35+
publisher,
36+
outputMode: 'all_messages',
37+
includeMessageHistory: false,
38+
toolNames: ['glob'],
39+
spawnableAgents: [],
40+
inputSchema: {
41+
params: paramsSchema,
42+
},
43+
handleSteps: function* ({ params }) {
44+
const patterns: GlobQuery[] = params?.patterns ?? []
45+
46+
for (const query of patterns) {
47+
yield {
48+
toolName: 'glob',
49+
input: {
50+
pattern: query.pattern,
51+
cwd: query.cwd,
52+
},
53+
}
54+
}
55+
},
56+
}
57+
58+
export default globMatcher

.agents/file-explorer/inline-file-explorer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const inlineFileExplorer: SecretAgentDefinition = {
2323
publisher,
2424
outputMode: 'last_message',
2525
toolNames: ['spawn_agents', 'read_files'],
26-
spawnableAgents: ['researcher-file-picker'],
26+
spawnableAgents: ['file-picker'],
2727
inputSchema: {
2828
prompt: {
2929
type: 'string',
@@ -47,7 +47,7 @@ const inlineFileExplorer: SecretAgentDefinition = {
4747
toolName: 'spawn_agents',
4848
input: {
4949
agents: filePickerPrompts.map((promptText) => ({
50-
agent_type: 'researcher-file-picker',
50+
agent_type: 'file-picker',
5151
prompt: promptText,
5252
})),
5353
},

.agents/file-picker.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

.agents/researcher/researcher-file-explorer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const fileExplorer: SecretAgentDefinition = {
2424
outputMode: 'structured_output',
2525
includeMessageHistory: false,
2626
toolNames: ['spawn_agents', 'set_output'],
27-
spawnableAgents: ['researcher-file-picker'],
27+
spawnableAgents: ['file-picker'],
2828
inputSchema: {
2929
prompt: {
3030
type: 'string',
@@ -47,7 +47,7 @@ const fileExplorer: SecretAgentDefinition = {
4747
toolName: 'spawn_agents',
4848
input: {
4949
agents: filePickerPrompts.map((promptText) => ({
50-
agent_type: 'researcher-file-picker',
50+
agent_type: 'file-picker',
5151
prompt: promptText,
5252
})),
5353
},

0 commit comments

Comments
 (0)