Skip to content

Commit c175ef1

Browse files
committed
Remove insert_content tool
1 parent 87af3b3 commit c175ef1

File tree

17 files changed

+11
-836
lines changed

17 files changed

+11
-836
lines changed

evals/packages/types/src/roo-code-defaults.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ export const rooCodeDefaults: RooCodeSettings = {
5757
fuzzyMatchThreshold: 1.0,
5858
experiments: {
5959
search_and_replace: false,
60-
insert_content: false,
6160
powerSteering: false,
6261
append_to_file: false,
6362
},

evals/packages/types/src/roo-code.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ export type CustomSupportPrompts = z.infer<typeof customSupportPromptsSchema>
271271
* ExperimentId
272272
*/
273273

274-
export const experimentIds = ["search_and_replace", "insert_content", "powerSteering", "append_to_file"] as const
274+
export const experimentIds = ["search_and_replace", "powerSteering", "append_to_file"] as const
275275

276276
export const experimentIdsSchema = z.enum(experimentIds)
277277

@@ -283,7 +283,6 @@ export type ExperimentId = z.infer<typeof experimentIdsSchema>
283283

284284
const experimentsSchema = z.object({
285285
search_and_replace: z.boolean(),
286-
insert_content: z.boolean(),
287286
powerSteering: z.boolean(),
288287
append_to_file: z.boolean(),
289288
})

src/core/Cline.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ import { listFilesTool } from "./tools/listFilesTool"
6767
import { readFileTool } from "./tools/readFileTool"
6868
import { writeToFileTool } from "./tools/writeToFileTool"
6969
import { applyDiffTool } from "./tools/applyDiffTool"
70-
import { insertContentTool } from "./tools/insertContentTool"
7170
import { searchAndReplaceTool } from "./tools/searchAndReplaceTool"
7271
import { listCodeDefinitionNamesTool } from "./tools/listCodeDefinitionNamesTool"
7372
import { searchFilesTool } from "./tools/searchFilesTool"
@@ -1414,8 +1413,6 @@ export class Cline extends EventEmitter<ClineEvents> {
14141413
return `[${block.name} for '${block.params.regex}'${
14151414
block.params.file_pattern ? ` in '${block.params.file_pattern}'` : ""
14161415
}]`
1417-
case "insert_content":
1418-
return `[${block.name} for '${block.params.path}']`
14191416
case "search_and_replace":
14201417
return `[${block.name} for '${block.params.path}']`
14211418
case "list_files":
@@ -1440,6 +1437,8 @@ export class Cline extends EventEmitter<ClineEvents> {
14401437
const modeName = getModeBySlug(mode, customModes)?.name ?? mode
14411438
return `[${block.name} in ${modeName} mode: '${message}']`
14421439
}
1440+
default:
1441+
return `[${block.name}]`
14431442
}
14441443
}
14451444

@@ -1597,9 +1596,6 @@ export class Cline extends EventEmitter<ClineEvents> {
15971596
case "apply_diff":
15981597
await applyDiffTool(this, block, askApproval, handleError, pushToolResult, removeClosingTag)
15991598
break
1600-
case "insert_content":
1601-
await insertContentTool(this, block, askApproval, handleError, pushToolResult, removeClosingTag)
1602-
break
16031599
case "search_and_replace":
16041600
await searchAndReplaceTool(
16051601
this,

src/core/diff/insert-groups.ts

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

src/core/prompts/__tests__/__snapshots__/system.test.ts.snap

Lines changed: 0 additions & 509 deletions
Large diffs are not rendered by default.

src/core/prompts/__tests__/system.test.ts

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ describe("SYSTEM_PROMPT", () => {
172172
// Reset experiments before each test to ensure they're disabled by default
173173
experiments = {
174174
[EXPERIMENT_IDS.SEARCH_AND_REPLACE]: false,
175-
[EXPERIMENT_IDS.INSERT_BLOCK]: false,
176175
}
177176
})
178177

@@ -483,7 +482,6 @@ describe("SYSTEM_PROMPT", () => {
483482
// Set experiments to explicitly disable experimental tools
484483
const experimentsConfig = {
485484
[EXPERIMENT_IDS.SEARCH_AND_REPLACE]: false,
486-
[EXPERIMENT_IDS.INSERT_BLOCK]: false,
487485
}
488486

489487
// Reset experiments
@@ -509,15 +507,13 @@ describe("SYSTEM_PROMPT", () => {
509507
const toolSections = prompt.split("\n## ").slice(1)
510508
const toolNames = toolSections.map((section) => section.split("\n")[0].trim())
511509
expect(toolNames).not.toContain("search_and_replace")
512-
expect(toolNames).not.toContain("insert_content")
513510
expect(prompt).toMatchSnapshot()
514511
})
515512

516513
it("should enable experimental tools when explicitly enabled", async () => {
517514
// Set experiments for testing experimental features
518515
const experimentsEnabled = {
519516
[EXPERIMENT_IDS.SEARCH_AND_REPLACE]: true,
520-
[EXPERIMENT_IDS.INSERT_BLOCK]: true,
521517
}
522518

523519
// Reset default experiments
@@ -542,53 +538,14 @@ describe("SYSTEM_PROMPT", () => {
542538
// Get all tool sections
543539
const toolSections = prompt.split("## ").slice(1) // Split by section headers and remove first non-tool part
544540
const toolNames = toolSections.map((section) => section.split("\n")[0].trim())
545-
546-
// Verify experimental tools are included in the prompt when enabled
547541
expect(toolNames).toContain("search_and_replace")
548-
expect(toolNames).toContain("insert_content")
549-
expect(prompt).toMatchSnapshot()
550-
})
551-
552-
it("should selectively enable experimental tools", async () => {
553-
// Set experiments for testing selective enabling
554-
const experimentsSelective = {
555-
[EXPERIMENT_IDS.SEARCH_AND_REPLACE]: true,
556-
[EXPERIMENT_IDS.INSERT_BLOCK]: false,
557-
}
558542

559-
// Reset default experiments
560-
experiments = undefined
561-
562-
const prompt = await SYSTEM_PROMPT(
563-
mockContext,
564-
"/test/path",
565-
false, // supportsComputerUse
566-
undefined, // mcpHub
567-
undefined, // diffStrategy
568-
undefined, // browserViewportSize
569-
defaultModeSlug, // mode
570-
undefined, // customModePrompts
571-
undefined, // customModes
572-
undefined, // globalCustomInstructions
573-
undefined, // diffEnabled
574-
experimentsSelective, // Use the selective experiments
575-
true, // enableMcpServerCreation
576-
)
577-
578-
// Get all tool sections
579-
const toolSections = prompt.split("## ").slice(1) // Split by section headers and remove first non-tool part
580-
const toolNames = toolSections.map((section) => section.split("\n")[0].trim())
581-
582-
// Verify only enabled experimental tools are included
583-
expect(toolNames).toContain("search_and_replace")
584-
expect(toolNames).not.toContain("insert_content")
585543
expect(prompt).toMatchSnapshot()
586544
})
587545

588546
it("should list all available editing tools in base instruction", async () => {
589547
const experiments = {
590548
[EXPERIMENT_IDS.SEARCH_AND_REPLACE]: true,
591-
[EXPERIMENT_IDS.INSERT_BLOCK]: true,
592549
}
593550

594551
const prompt = await SYSTEM_PROMPT(
@@ -610,13 +567,11 @@ describe("SYSTEM_PROMPT", () => {
610567
// Verify base instruction lists all available tools
611568
expect(prompt).toContain("apply_diff (for replacing lines in existing files)")
612569
expect(prompt).toContain("write_to_file (for creating new files or complete file rewrites)")
613-
expect(prompt).toContain("insert_content (for adding lines to existing files)")
614570
expect(prompt).toContain("search_and_replace (for finding and replacing individual pieces of text)")
615571
})
616572
it("should provide detailed instructions for each enabled tool", async () => {
617573
const experiments = {
618574
[EXPERIMENT_IDS.SEARCH_AND_REPLACE]: true,
619-
[EXPERIMENT_IDS.INSERT_BLOCK]: true,
620575
}
621576

622577
const prompt = await SYSTEM_PROMPT(
@@ -639,7 +594,6 @@ describe("SYSTEM_PROMPT", () => {
639594
expect(prompt).toContain(
640595
"You should always prefer using other editing tools over write_to_file when making changes to existing files since write_to_file is much slower and cannot handle large files.",
641596
)
642-
expect(prompt).toContain("The insert_content tool adds lines of text to files")
643597
expect(prompt).toContain("The search_and_replace tool finds and replaces text or regex in files")
644598
})
645599
})

src/core/prompts/sections/rules.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ function getEditingInstructions(diffStrategy?: DiffStrategy, experiments?: Recor
1616

1717
availableTools.push("append_to_file (for appending content to the end of files)")
1818

19-
if (experiments?.["insert_content"]) {
20-
availableTools.push("insert_content (for adding lines to existing files)")
21-
}
2219
if (experiments?.["search_and_replace"]) {
2320
availableTools.push("search_and_replace (for finding and replacing individual pieces of text)")
2421
}
@@ -30,14 +27,6 @@ function getEditingInstructions(diffStrategy?: DiffStrategy, experiments?: Recor
3027
"- The append_to_file tool adds content to the end of files, such as appending new log entries or adding new data records. This tool will always add the content at the end of the file.",
3128
)
3229
}
33-
34-
// Additional details for experimental features
35-
if (experiments?.["insert_content"]) {
36-
instructions.push(
37-
"- The insert_content tool adds lines of text to files, such as adding a new function to a JavaScript file or inserting a new route in a Python file. This tool will insert it at the specified line location. It can support multiple operations at once.",
38-
)
39-
}
40-
4130
if (experiments?.["search_and_replace"]) {
4231
instructions.push(
4332
"- The search_and_replace tool finds and replaces text or regex in files. This tool allows you to search for a specific regex pattern or text and replace it with another value. Be cautious when using this tool to ensure you are replacing the correct text. It can support multiple operations at once.",

src/core/prompts/tools/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { getWriteToFileDescription } from "./write-to-file"
1212
import { getAppendToFileDescription } from "./append-to-file"
1313
import { getSearchFilesDescription } from "./search-files"
1414
import { getListFilesDescription } from "./list-files"
15-
import { getInsertContentDescription } from "./insert-content"
1615
import { getSearchAndReplaceDescription } from "./search-and-replace"
1716
import { getListCodeDefinitionNamesDescription } from "./list-code-definition-names"
1817
import { getBrowserActionDescription } from "./browser-action"
@@ -40,7 +39,6 @@ const toolDescriptionMap: Record<string, (args: ToolArgs) => string | undefined>
4039
access_mcp_resource: (args) => getAccessMcpResourceDescription(args),
4140
switch_mode: () => getSwitchModeDescription(),
4241
new_task: (args) => getNewTaskDescription(args),
43-
insert_content: (args) => getInsertContentDescription(args),
4442
search_and_replace: (args) => getSearchAndReplaceDescription(args),
4543
apply_diff: (args) =>
4644
args.diffStrategy ? args.diffStrategy.getToolDescription({ cwd: args.cwd, toolOptions: args.toolOptions }) : "",
@@ -124,6 +122,5 @@ export {
124122
getUseMcpToolDescription,
125123
getAccessMcpResourceDescription,
126124
getSwitchModeDescription,
127-
getInsertContentDescription,
128125
getSearchAndReplaceDescription,
129126
}

src/core/prompts/tools/insert-content.ts

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

0 commit comments

Comments
 (0)