@@ -98,7 +98,7 @@ Respond with ONLY one word: "QUESTION" or "IMPLEMENTATION"`
9898 return true , "Classified as an implementation request" , nil
9999}
100100
101- // buildToolRegistry creates a tool registry with read tools and go_sandbox access.
101+ // buildToolRegistry creates a tool registry with read tools, edit tools, and go_sandbox access.
102102func (a * VerificationAgent ) buildToolRegistry (verificationSession * session.Session ) * tools.Registry {
103103 // Use the orchestrator's authorizer (which respects session-level authorizations)
104104 registry := tools .NewRegistryWithSecrets (a .orch .authorizer , secretdetect .NewDetector ())
@@ -109,6 +109,41 @@ func (a *VerificationAgent) buildToolRegistry(verificationSession *session.Sessi
109109 // Read File - essential for checking modified files
110110 registry .Register (a .orch .getReadFileTool (modelFamily , verificationSession ))
111111
112+ // Edit file tools - allow verification agent to fix issues it finds
113+ if a .orch .shouldUseReplaceFileTool (modelFamily ) {
114+ registry .RegisterSpec (
115+ & tools.ReplaceFileToolSpec {},
116+ tools .NewReplaceFileToolFactory (a .orch .fs , verificationSession ),
117+ )
118+ }
119+ if a .orch .shouldUseNonDiffUpdateTool (modelFamily ) {
120+ registry .RegisterSpec (
121+ & tools.WriteFileJSONToolSpec {},
122+ tools .NewWriteFileJSONToolFactory (a .orch .fs , verificationSession ),
123+ )
124+ } else if a .orch .shouldUseSimpleSingleDiffTool (modelFamily ) {
125+ registry .RegisterSpec (
126+ & tools.WriteFileReplaceSingleToolSpec {},
127+ tools .NewWriteFileReplaceSingleToolFactory (a .orch .fs , verificationSession ),
128+ )
129+ } else if a .orch .shouldUseSimpleDiffTool (modelFamily ) {
130+ registry .RegisterSpec (
131+ & tools.WriteFileReplaceToolSpec {},
132+ tools .NewWriteFileReplaceToolFactory (a .orch .fs , verificationSession ),
133+ )
134+ } else {
135+ registry .RegisterSpec (
136+ & tools.WriteFileDiffToolSpec {},
137+ tools .NewWriteFileDiffToolFactory (a .orch .fs , verificationSession ),
138+ )
139+ }
140+
141+ // Create file tool - for creating new files if needed
142+ registry .RegisterSpec (
143+ & tools.CreateFileToolSpec {},
144+ tools .NewCreateFileToolFactory (a .orch .fs , verificationSession ),
145+ )
146+
112147 // Search tools - for finding related files
113148 registry .Register (tools .NewSearchFilesTool (a .orch .fs ))
114149 registry .Register (tools .NewSearchFileContentTool (a .orch .fs ))
@@ -164,6 +199,7 @@ Verify that the code changes are correct by:
1641992. Running the project build command to ensure it compiles
1652003. Running the linter (if available) to catch style/quality issues
1662014. Running relevant tests to ensure functionality works
202+ 5. Fixing simple issues automatically when possible (typos, formatting, minor errors)
167203
168204## Modified Files
169205%s
@@ -175,6 +211,9 @@ Verify that the code changes are correct by:
175211%s
176212
177213## Available Tools
214+ - **edit_file**: Update existing files using diff or text replacement
215+ - **create_file**: Create new files if needed
216+ - **replace_file**: Replace entire file content (use with caution)
178217- **go_sandbox**: Execute Go code in a sandboxed environment and run shell commands
179218- **read_file**: Read files to check modifications
180219- **search_files/search_file_content**: Find relevant files
@@ -193,7 +232,12 @@ Note: Commands will go through normal authorization checks. The system will dete
1932323. Run code formatting to ensure code follows project style conventions
1942334. Run linting if a linter is configured
1952345. Run tests - if tests exist in the project, they MUST be run.
196- 6. Report any failures with clear error messages
235+ 6. **IF YOU CAN AUTOMATICALLY FIX SIMPLE ISSUES**, do so and re-run verification:
236+ - Minor formatting errors detected by linters
237+ - Missing imports
238+ - Typos or syntax errors
239+ - Simple logic mistakes
240+ 7. Report any failures with clear error messages
197241
198242## Important Notes
199243- Be efficient: don't read files that weren't modified
@@ -202,6 +246,9 @@ Note: Commands will go through normal authorization checks. The system will dete
202246- If a command fails, report the error but continue with other checks
203247- Keep command output concise (avoid verbose flags unless debugging)
204248- Use go_sandbox for all command execution (build, lint, test)
249+ - **Only make automatic fixes for simple, obvious issues** - leave complex bugs for the user
250+ - Always re-run verification after making fixes
251+ - Read files before editing them (read-before-write rule)
205252
206253When complete, provide a summary wrapped in <verification_result> tags:
207254<verification_result>
0 commit comments