Skip to content

Commit a8978f0

Browse files
committed
Update file-picker-max to use haiku for file listing as well
1 parent f6738fd commit a8978f0

File tree

2 files changed

+63
-7
lines changed

2 files changed

+63
-7
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { publisher } from '../constants'
2+
import {
3+
PLACEHOLDER,
4+
type SecretAgentDefinition,
5+
} from '../types/secret-agent-definition'
6+
7+
const definition: SecretAgentDefinition = {
8+
id: 'file-lister',
9+
displayName: 'Liszt the File Lister',
10+
publisher,
11+
model: 'anthropic/claude-haiku-4.5',
12+
spawnerPrompt: 'Lists files that are relevant to the prompt',
13+
inputSchema: {
14+
prompt: {
15+
type: 'string',
16+
description: 'A coding task to complete',
17+
},
18+
},
19+
outputMode: 'last_message',
20+
includeMessageHistory: false,
21+
toolNames: [],
22+
spawnableAgents: [],
23+
24+
systemPrompt: `You are an expert at finding relevant files in a codebase and listing them out. ${PLACEHOLDER.FILE_TREE_PROMPT}`,
25+
instructionsPrompt: `Instructions:
26+
- Do not use any tools.
27+
- Do not write any analysis.
28+
- List out the full paths of up to 12 files that are relevant to the prompt, separated by newlines.
29+
30+
Do not write an introduction. Do not use any tools. Do not write anything else other than the file paths.
31+
`.trim(),
32+
}
33+
34+
export default definition

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

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,43 @@ const definition: SecretAgentDefinition = {
2121
},
2222
outputMode: 'last_message',
2323
includeMessageHistory: false,
24-
toolNames: [],
25-
spawnableAgents: [],
24+
toolNames: ['spawn_agents'],
25+
spawnableAgents: ['file-lister'],
2626

2727
systemPrompt: `You are an expert at finding relevant files in a codebase. ${PLACEHOLDER.FILE_TREE_PROMPT_SMALL}`,
2828
instructionsPrompt: `Instructions:
2929
- Don't use any tools.
30-
- Provide a short report of the locations in the codebase that could be helpful. Focus on the files that are most relevant to the user prompt.
30+
- Provide a short report of the locations in the codebase that could be helpful. Focus on the files that are most relevant to the user prompt. Leave out irrelevant locations.
3131
In your report, please give a very concise analysis that includes the full paths of files that are relevant and (briefly) how they could be useful.
3232
`.trim(),
3333

34-
handleSteps: function* ({ agentState, prompt, params }) {
35-
yield {
36-
toolName: 'find_files',
37-
input: { prompt: prompt ?? '' },
34+
handleSteps: function* ({ prompt, logger }) {
35+
const { toolResult: fileListerResults } = yield {
36+
toolName: 'spawn_agents',
37+
input: {
38+
agents: [
39+
{
40+
agent_type: 'file-lister',
41+
prompt: prompt ?? '',
42+
},
43+
],
44+
},
3845
} satisfies ToolCall
46+
47+
const fileListerResult = fileListerResults?.[0]
48+
const filesStr =
49+
fileListerResult && fileListerResult.type === 'json'
50+
? ((fileListerResult.value as any)?.[0]?.value?.value as string)
51+
: ''
52+
const files = filesStr.split('\n').filter(Boolean)
53+
54+
yield {
55+
toolName: 'read_files',
56+
input: {
57+
paths: files,
58+
},
59+
}
60+
3961
yield 'STEP_ALL'
4062
},
4163
}

0 commit comments

Comments
 (0)