Skip to content

Commit bf5872d

Browse files
committed
Overhaul the example agents
1 parent 68e4f6c commit bf5872d

File tree

9 files changed

+149
-195
lines changed

9 files changed

+149
-195
lines changed

.agents/changes-reviewer.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,19 @@ const definition: AgentDefinition = {
1414

1515
includeMessageHistory: false,
1616

17+
spawnPurposePrompt:
18+
'Spawn when you need to review code changes in the git diff or staged changes',
19+
20+
toolNames: ['read_files', 'run_terminal_command', 'spawn_agents'],
21+
spawnableAgents: ['codebuff/file-explorer@0.0.1'],
22+
1723
inputSchema: {
1824
prompt: {
1925
type: 'string',
2026
description:
2127
'Please provide a short description of the changes you want to review',
2228
},
2329
},
24-
outputMode: 'last_message',
25-
26-
toolNames: ['read_files', 'run_terminal_command', 'end_turn'],
27-
28-
spawnPurposePrompt: 'Spawn when you need to review code changes',
2930

3031
systemPrompt:
3132
'You are an expert software developer. Your job is to review code changes and provide helpful feedback.',
@@ -102,7 +103,16 @@ Use the following guidelines to review the changes and suggest improvements:
102103
}
103104
}
104105

105-
// Step 7: Let AI review the changes (and take as many steps as needed)
106+
// Step 5: Put words in the AI's mouth to get it to spawn the file explorer.
107+
yield {
108+
toolName: 'add_message',
109+
args: {
110+
role: 'assistant',
111+
content:
112+
'Now I will spawn a file explorer to find any missing codebase context, and then review the changes.',
113+
},
114+
}
115+
106116
yield 'STEP_ALL'
107117
},
108118
}

.agents/examples/diff-reviewer-1.ts renamed to .agents/examples/01-basic-diff-reviewer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { AgentDefinition } from '../types/agent-definition'
22

33
const definition: AgentDefinition = {
4-
id: 'diff-reviewer-1',
5-
displayName: 'Diff Reviewer (Level 1)',
4+
id: 'basic-diff-reviewer',
5+
displayName: 'Basic Diff Reviewer',
66
model: 'anthropic/claude-4-sonnet-20250522',
77
toolNames: ['read_files', 'run_terminal_command'],
88

.agents/git-committer.ts renamed to .agents/examples/02-intermediate-git-committer.ts

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
import { publisher, version } from './constants'
2-
31
import type {
42
AgentDefinition,
53
AgentStepContext,
6-
} from './types/agent-definition'
4+
} from '../types/agent-definition'
75

86
const definition: AgentDefinition = {
97
id: 'git-committer',
10-
version,
11-
publisher,
12-
displayName: 'Git Committer',
8+
displayName: 'Intermediate Git Committer',
139
model: 'anthropic/claude-4-sonnet-20250522',
1410
toolNames: ['read_files', 'run_terminal_command', 'add_message', 'end_turn'],
1511

@@ -20,20 +16,17 @@ const definition: AgentDefinition = {
2016
},
2117
},
2218

23-
includeMessageHistory: false,
24-
outputMode: 'last_message',
25-
2619
spawnPurposePrompt:
2720
'Spawn when you need to commit code changes to git with an appropriate commit message',
2821

2922
systemPrompt:
3023
'You are an expert software developer. Your job is to create a git commit with a really good commit message.',
3124

3225
instructionsPrompt:
33-
'Follow the steps to create a good commit: analyze changes with git diff and git log, read relevant files for context, stage appropriate files, analyze changes, and create a commit with proper formatting including the Codebuff footer.',
26+
'Follow the steps to create a good commit: analyze changes with git diff and git log, read relevant files for context, stage appropriate files, analyze changes, and create a commit with proper formatting.',
3427

3528
handleSteps: function* ({ agentState, prompt, params }: AgentStepContext) {
36-
// Step 1: Run git diff and git log to analyze changes
29+
// Step 1: Run git diff and git log to analyze changes.
3730
yield {
3831
toolName: 'run_terminal_command',
3932
args: {
@@ -52,7 +45,7 @@ const definition: AgentDefinition = {
5245
},
5346
}
5447

55-
// Step 2: Let AI analyze the changes and read relevant files for context
48+
// Step 2: Put words in AI's mouth so it will read files next.
5649
yield {
5750
toolName: 'add_message',
5851
args: {
@@ -62,16 +55,16 @@ const definition: AgentDefinition = {
6255
},
6356
}
6457

65-
// Step 3: Let AI decide which files to read and stage
58+
// Step 3: Let AI generate a step to decide which files to read.
6659
yield 'STEP'
6760

68-
// Step 4: Let AI analyze staged changes and compose commit message
61+
// Step 4: Put words in AI's mouth to analyze the changes and create a commit.
6962
yield {
7063
toolName: 'add_message',
7164
args: {
7265
role: 'assistant',
7366
content:
74-
"Now I'll analyze the staged changes and create a commit with the proper Codebuff footer format.",
67+
"Now I'll analyze the changes and create a commit with a good commit message.",
7568
},
7669
}
7770

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import type { AgentDefinition } from '../types/agent-definition'
2+
3+
const definition: AgentDefinition = {
4+
id: 'advanced-file-explorer',
5+
displayName: 'Dora the File Explorer',
6+
model: 'openai/gpt-5',
7+
8+
spawnPurposePrompt:
9+
'Spawns multiple file picker agents in parallel to comprehensively explore the codebase from different perspectives',
10+
11+
includeMessageHistory: false,
12+
toolNames: ['spawn_agents', 'set_output'],
13+
spawnableAgents: [`codebuff/file-picker@0.0.1`],
14+
15+
inputSchema: {
16+
prompt: {
17+
description: 'What you need to accomplish by exploring the codebase',
18+
type: 'string',
19+
},
20+
params: {
21+
type: 'object',
22+
properties: {
23+
prompts: {
24+
description:
25+
'List of 1-4 different parts of the codebase that could be useful to explore',
26+
type: 'array',
27+
items: {
28+
type: 'string',
29+
},
30+
},
31+
},
32+
required: ['prompts'],
33+
additionalProperties: false,
34+
},
35+
},
36+
outputMode: 'structured_output',
37+
outputSchema: {
38+
type: 'object',
39+
properties: {
40+
results: {
41+
type: 'string',
42+
description: 'The results of the file exploration',
43+
},
44+
},
45+
required: ['results'],
46+
additionalProperties: false,
47+
},
48+
49+
handleSteps: function* ({ prompt, params }) {
50+
const prompts: string[] = params?.prompts ?? []
51+
const filePickerPrompts = prompts.map(
52+
(focusPrompt) =>
53+
`Based on the overall goal "${prompt}", find files related to this specific area: ${focusPrompt}`,
54+
),
55+
{ toolResult: spawnResult } = yield {
56+
toolName: 'spawn_agents',
57+
args: {
58+
agents: filePickerPrompts.map((promptText) => ({
59+
agent_type: 'codebuff/file-picker@0.0.1',
60+
prompt: promptText,
61+
})),
62+
},
63+
}
64+
yield {
65+
toolName: 'set_output',
66+
args: {
67+
results: spawnResult,
68+
},
69+
}
70+
},
71+
}
72+
73+
export default definition

.agents/examples/diff-reviewer-2.ts

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

.agents/examples/diff-reviewer-3.ts

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

.agents/file-explorer.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ const definition: AgentDefinition = {
77
version,
88
publisher,
99
displayName: 'Dora the File Explorer',
10+
model: 'anthropic/claude-4-sonnet-20250522',
11+
1012
spawnPurposePrompt:
1113
'Spawns multiple file picker agents in parallel to comprehensively explore the codebase from different perspectives',
12-
model: 'anthropic/claude-4-sonnet-20250522',
13-
outputMode: 'structured_output',
14+
1415
includeMessageHistory: false,
1516
toolNames: ['spawn_agents', 'set_output'],
1617
spawnableAgents: [`file-picker`],
18+
19+
outputMode: 'structured_output',
1720
inputSchema: {
1821
prompt: {
1922
description: 'What you need to accomplish by exploring the codebase',
@@ -35,6 +38,18 @@ const definition: AgentDefinition = {
3538
additionalProperties: false,
3639
},
3740
},
41+
outputSchema: {
42+
type: 'object',
43+
properties: {
44+
results: {
45+
type: 'string',
46+
description: 'The results of the file exploration',
47+
},
48+
},
49+
required: ['results'],
50+
additionalProperties: false,
51+
},
52+
3853
handleSteps: function* ({ prompt, params }) {
3954
const prompts: string[] = params?.prompts ?? []
4055
const filePickerPrompts = prompts.map(

0 commit comments

Comments
 (0)