Skip to content

Commit 35a8105

Browse files
committed
Add validator and code-reviewer
1 parent b00bec1 commit 35a8105

File tree

5 files changed

+128
-118
lines changed

5 files changed

+128
-118
lines changed

.agents/base2/base2.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ import {
88

99
export const createBase2: (
1010
mode: 'normal' | 'max',
11-
) => Omit<SecretAgentDefinition, 'id'> = (mode) => {
12-
const isMax = mode === 'max'
11+
) => Omit<SecretAgentDefinition, 'id'> = () => {
1312
return {
1413
publisher,
1514
model: 'anthropic/claude-sonnet-4.5',
@@ -43,7 +42,8 @@ export const createBase2: (
4342
'researcher-docs',
4443
'commander',
4544
'generate-plan',
46-
'reviewer',
45+
'code-reviewer',
46+
'validator',
4747
'context-pruner',
4848
),
4949

@@ -63,9 +63,9 @@ Continue to spawn layers of agents until have completed the user's request or re
6363
- Spawn file pickers, code-searcher, directory-lister, glob-matcher, commanders, and researchers before making edits.
6464
- Spawn generate-plan agent after you have gathered all the context you need (and not before!).
6565
- Only make edits after generating a plan.
66-
- Reviewers should be spawned after you have made your edits.
66+
- Code reviewers/validators should be spawned after you have made your edits.
6767
- **No need to include context:** When prompting an agent, realize that many agents can already see the entire conversation history, so you can be brief in prompting them without needing to include context.
68-
- **Don't spawn reviewers for trivial changes or quick follow-ups:** You should spawn the reviewer for most changes, but not for little changes or simple follow-ups.
68+
- **Don't spawn code reviewers/validators for trivial changes or quick follow-ups:** You should spawn the code reviewer/validator for most changes, but not for little changes or simple follow-ups.
6969
7070
# Core Mandates
7171
@@ -130,8 +130,8 @@ The user asks you to implement a new feature. You respond in multiple steps:
130130
2a. Read all the relevant files using the read_files tool.
131131
3. Spawn a generate-plan agent to generate a plan for the changes.
132132
4. Use the str_replace or write_file tool to make the changes.
133-
5. Spawn a reviewer to review the changes.
134-
6. Fix any issues raised by the reviewer.
133+
5. Spawn a code-reviewer to review the changes. Consider making changes suggested by the code-reviewer.
134+
6. Spawn a validator to run validation commands (tests, typechecks, etc.) to ensure the changes are correct.
135135
7. Inform the user that you have completed the task in one sentence without a final summary.`,
136136

137137
stepPrompt: `Don't forget to spawn agents that could help, especially: the file-picker-max and find-all-referencer to get codebase context, the generate-plan agent to create a plan, and the reviewer to review changes.`,

.agents/codebase-commands-explorer.ts

Lines changed: 11 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,25 @@ import type { AgentDefinition } from './types/agent-definition'
33
const definition: AgentDefinition = {
44
id: 'codebase-commands-explorer',
55
displayName: 'Codebase Commands Explorer',
6-
publisher: 'james',
7-
model: 'openai/gpt-5',
8-
reasoningOptions: {
9-
enabled: true,
10-
effort: 'low',
11-
exclude: true,
12-
},
6+
publisher: 'codebuff',
7+
model: 'x-ai/grok-code-fast-1',
138

149
spawnerPrompt: `Analyzes any project's codebase to comprehensively discover all commands needed to build, test, and run the project. Provides detailed analysis of project structure, tech stack, and working commands with confidence scores.`,
1510

16-
toolNames: ['spawn_agents', 'set_output'],
11+
toolNames: ['spawn_agents', 'read_files', 'set_output'],
1712
spawnableAgents: [
18-
'codebuff/file-explorer@0.0.4',
19-
'codebuff/read-only-commander-lite@0.0.1',
13+
'file-picker',
14+
'code-searcher',
15+
'directory-lister',
16+
'glob-matcher',
17+
'commander',
2018
],
2119

2220
inputSchema: {
2321
prompt: {
2422
type: 'string',
2523
description:
26-
'Optional specific focus areas or requirements for the codebase analysis (e.g., "focus on test commands" or "include CI/CD analysis")',
24+
'Optional specific focus areas or requirements for the codebase analysis (e.g., "focus on test commands")',
2725
},
2826
},
2927

@@ -117,111 +115,13 @@ const definition: AgentDefinition = {
117115
required: ['command', 'description', 'category', 'confidenceScore'],
118116
},
119117
},
120-
setupRequirements: {
121-
type: 'array',
122-
items: {
123-
type: 'object',
124-
properties: {
125-
requirement: {
126-
type: 'string',
127-
description: 'Setup requirement description',
128-
},
129-
commands: {
130-
type: 'array',
131-
items: { type: 'string' },
132-
description: 'Commands to fulfill this requirement',
133-
},
134-
priority: {
135-
type: 'string',
136-
enum: ['critical', 'recommended', 'optional'],
137-
description: 'Priority level',
138-
},
139-
},
140-
required: ['requirement', 'commands', 'priority'],
141-
},
142-
},
143-
cicdAnalysis: {
144-
type: 'object',
145-
properties: {
146-
ciFilesFound: {
147-
type: 'array',
148-
items: { type: 'string' },
149-
description: 'CI/CD configuration files detected',
150-
},
151-
officialCommands: {
152-
type: 'array',
153-
items: { type: 'string' },
154-
description: 'Commands found in CI/CD files',
155-
},
156-
platforms: {
157-
type: 'array',
158-
items: { type: 'string' },
159-
description:
160-
'CI/CD platforms detected (GitHub Actions, GitLab CI, etc.)',
161-
},
162-
},
163-
required: ['ciFilesFound', 'officialCommands', 'platforms'],
164-
},
165118
},
166-
required: [
167-
'projectOverview',
168-
'workingCommands',
169-
'setupRequirements',
170-
'cicdAnalysis',
171-
],
119+
required: ['projectOverview', 'workingCommands'],
172120
},
173121

174122
systemPrompt: `You are an expert codebase explorer that comprehensively analyzes any software project to discover all build, test, and run commands. You orchestrate multiple specialized agents to explore the project structure and test commands in parallel for maximum efficiency.`,
175123

176-
instructionsPrompt: `Your mission is to provide a comprehensive analysis of any codebase to discover all working commands for building, testing, and running the project.
177-
178-
## Analysis Strategy:
179-
180-
1. **Project Structure Exploration**: First spawn file-explorer to understand the project layout, key files, and technology stack.
181-
In parallel, spawn a second file-explorer to learn about the build, lint, and testing processes across the codebase.
182-
183-
2. **Massive Parallel Command Testing**: Only after fully completing step 1 and getting back the results, spawn MANY (10-15) read-only-commander agents simultaneously to test different command combinations, including for any relevant sub-directories if this is a monorepo.
184-
Look for commands for the following project types:
185-
- Web apps: next.js, react, vue, etc. commands (build, test, start, dev, lint, etc.)
186-
- Node.js projects: npm/yarn/pnpm commands (build, test, start, dev, lint, etc.)
187-
- Python projects: pip, pytest, setup.py, tox commands
188-
- Rust projects: cargo commands (build, test, run, check, etc.)
189-
...And so on for all project types
190-
191-
Include CI/CD Analysis: Have agents examine CI/CD files (.github/workflows, .gitlab-ci.yml, etc.) to discover official build processes
192-
193-
3. **Final Analysis**: Use the set_output tool to output the results of the analysis. Rate each working command based on:
194-
- Success rate of execution
195-
- Presence in official documentation/CI
196-
- Standard conventions for the project type
197-
- Output quality and expected behavior
198-
199-
## Command Categories to Test:
200-
- **install**: Dependency installation commands
201-
- **build**: Compilation and build commands
202-
- **test**: All types of testing (unit, integration, e2e)
203-
- **run**: Application execution commands
204-
- **dev**: Development server/watch commands
205-
- **lint**: Code linting and static analysis
206-
- **format**: Code formatting commands
207-
- **clean**: Cleanup and reset commands
208-
209-
## Be Extremely Thorough:
210-
- Try multiple package managers if multiple are detected
211-
- Test both short and long command forms
212-
- Check for custom scripts in package.json, Makefile, etc.
213-
- Test commands with different flags and options
214-
- Verify commands work from different directories
215-
- Check for environment-specific requirements
216-
217-
## Special Focus Areas:
218-
- Look for monorepo structures and workspace commands
219-
- Detect containerized setups and associated commands
220-
- Find database setup/migration commands
221-
- Identify development vs production commands
222-
- Discover deployment and release commands
223-
224-
Provide a comprehensive, structured output that gives developers everything they need to understand and work with the codebase immediately.`,
124+
instructionsPrompt: `Your mission is to provide a comprehensive analysis of any codebase to discover all working commands for building, testing, and running the project, according to the user prompt.`,
225125
}
226126

227127
export default definition
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import reviewer from './reviewer'
2+
import type { SecretAgentDefinition } from '../types/secret-agent-definition'
3+
4+
const definition: SecretAgentDefinition = {
5+
...reviewer,
6+
id: 'code-reviewer-gpt-5',
7+
model: 'openai/gpt-5',
8+
}
9+
10+
export default definition

.agents/reviewer/code-reviewer.ts

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import { publisher } from '../constants'
2+
import {
3+
PLACEHOLDER,
4+
type SecretAgentDefinition,
5+
} from '../types/secret-agent-definition'
6+
import type { Model } from '@codebuff/common/old-constants'
7+
8+
export const createReviewer = (
9+
model: Model,
10+
): Omit<SecretAgentDefinition, 'id'> => ({
11+
model,
12+
displayName: 'Nit Pick Nick',
13+
spawnerPrompt:
14+
'Reviews file changes and responds with critical feedback. Use this after making any significant change to the codebase; otherwise, no need to use this agent for minor changes since it takes a second.',
15+
inputSchema: {
16+
prompt: {
17+
type: 'string',
18+
description: 'What should be reviewed. Be brief.',
19+
},
20+
},
21+
outputMode: 'last_message',
22+
toolNames: [],
23+
spawnableAgents: [],
24+
25+
inheritParentSystemPrompt: true,
26+
includeMessageHistory: true,
27+
28+
instructionsPrompt: `For reference, here is the original user request:
29+
<user_message>
30+
${PLACEHOLDER.USER_INPUT_PROMPT}
31+
</user_message>
32+
33+
Your task is to provide helpful feedback on the last file changes made by the assistant.
34+
35+
NOTE: You cannot make any changes directly! You can only suggest changes.
36+
37+
You should critique the code changes made recently in the above conversation. Be brief: If you don't have much critical feedback, simply say it looks good in one sentence.
38+
39+
- Focus on getting to a complete and correct solution as the top priority.
40+
- Make sure all the requirements in the user's message are addressed. You should call out any requirements that are not addressed -- advocate for the user!
41+
- Try to keep any changes to the codebase as minimal as possible.
42+
- Simplify any logic that can be simplified.
43+
- Where a function can be reused, reuse it and do not create a new one.
44+
- Make sure that no new dead code is introduced.
45+
- Make sure there are no missing imports.
46+
- Make sure no sections were deleted that weren't supposed to be deleted.
47+
- Make sure the new code matches the style of the existing code.
48+
- Make sure there are no unnecessary try/catch blocks. Prefer to remove those.
49+
50+
Be extremely concise.`,
51+
})
52+
53+
const definition: SecretAgentDefinition = {
54+
id: 'code-reviewer',
55+
publisher,
56+
...createReviewer('anthropic/claude-sonnet-4.5'),
57+
}
58+
59+
export default definition

.agents/validator.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { publisher } from './constants'
2+
import type { AgentDefinition } from './types/agent-definition'
3+
4+
const fixer: AgentDefinition = {
5+
id: 'validator',
6+
publisher,
7+
model: 'anthropic/claude-sonnet-4.5',
8+
displayName: 'Validator',
9+
spawnerPrompt:
10+
'Attempts to build/test/verify the project and automatically fix issues it finds. Useful after making edits or when CI/typecheck/tests are failing. Works across monorepos: discovers scripts (build/test/typecheck/lint), runs them, analyzes failures, and applies minimal fixes in a loop until success or max attempts.',
11+
inputSchema: {
12+
prompt: {
13+
type: 'string',
14+
description:
15+
'Optional context about what to verify/fix (e.g., a specific package, script, or error focus).',
16+
},
17+
},
18+
outputMode: 'last_message',
19+
20+
includeMessageHistory: true,
21+
inheritParentSystemPrompt: true,
22+
23+
toolNames: ['read_files', 'str_replace', 'write_file', 'spawn_agents'],
24+
spawnableAgents: [
25+
'codebase-commands-explorer',
26+
'file-picker',
27+
'code-searcher',
28+
'directory-lister',
29+
'glob-matcher',
30+
'commander',
31+
],
32+
33+
instructionsPrompt: `Insructions:
34+
1. Spawn the codebase-commands-explorer agent to discover how to build/test/verify the project.
35+
2. Run the commands to validate the project
36+
3. Fix any issues found
37+
4. Repeat 2 and 3 until the project is validated successfully.
38+
5. Give a final summary that includes the exact commands you ran and the issues you fixed and the final state (are all the types/tests passing?). Be extremely concise.`,
39+
}
40+
41+
export default fixer

0 commit comments

Comments
 (0)