Skip to content

Commit f848795

Browse files
refactor: replace fetch_instructions with skill tool and built-in skills (#11084)
Co-authored-by: Roo Code <roomote@roocode.com>
1 parent 0c53f19 commit f848795

80 files changed

Lines changed: 1938 additions & 636 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/cli/src/ui/components/tools/types.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,7 @@ export type ToolCategory =
1616
| "other"
1717

1818
export function getToolCategory(toolName: string): ToolCategory {
19-
const fileReadTools = [
20-
"readFile",
21-
"read_file",
22-
"fetchInstructions",
23-
"fetch_instructions",
24-
"listFilesTopLevel",
25-
"listFilesRecursive",
26-
"list_files",
27-
]
19+
const fileReadTools = ["readFile", "read_file", "skill", "listFilesTopLevel", "listFilesRecursive", "list_files"]
2820

2921
const fileWriteTools = [
3022
"editedExistingFile",

apps/cli/src/ui/components/tools/utils.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ export function getToolDisplayName(toolName: string): string {
5050
// File read operations
5151
readFile: "Read",
5252
read_file: "Read",
53-
fetchInstructions: "Fetch Instructions",
54-
fetch_instructions: "Fetch Instructions",
53+
skill: "Load Skill",
5554
listFilesTopLevel: "List Files",
5655
listFilesRecursive: "List Files (Recursive)",
5756
list_files: "List Files",
@@ -107,8 +106,7 @@ export function getToolIconName(toolName: string): IconName {
107106
// File read operations
108107
readFile: "file",
109108
read_file: "file",
110-
fetchInstructions: "file",
111-
fetch_instructions: "file",
109+
skill: "file",
112110
listFilesTopLevel: "folder",
113111
listFilesRecursive: "folder",
114112
list_files: "folder",

packages/types/src/global-settings.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ export const globalSettingsSchema = z.object({
199199
telemetrySetting: telemetrySettingsSchema.optional(),
200200

201201
mcpEnabled: z.boolean().optional(),
202-
enableMcpServerCreation: z.boolean().optional(),
203202

204203
mode: z.string().optional(),
205204
modeApiConfigs: z.record(z.string(), z.string()).optional(),

packages/types/src/skills.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
export interface SkillMetadata {
66
name: string // Required: skill identifier
77
description: string // Required: when to use this skill
8-
path: string // Absolute path to SKILL.md
9-
source: "global" | "project" // Where the skill was discovered
8+
path: string // Absolute path to SKILL.md (or "<built-in:name>" for built-in skills)
9+
source: "global" | "project" | "built-in" // Where the skill was discovered
1010
mode?: string // If set, skill is only available in this mode
1111
}
1212

packages/types/src/tool.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ export const toolNames = [
3333
"attempt_completion",
3434
"switch_mode",
3535
"new_task",
36-
"fetch_instructions",
3736
"codebase_search",
3837
"update_todo_list",
3938
"run_slash_command",
39+
"skill",
4040
"generate_image",
4141
"custom_tool",
4242
] as const

packages/types/src/vscode-extension-host.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,6 @@ export type ExtensionState = Pick<
362362
experiments: Experiments // Map of experiment IDs to their enabled state
363363

364364
mcpEnabled: boolean
365-
enableMcpServerCreation: boolean
366365

367366
mode: string
368367
customModes: ModeConfig[]
@@ -502,7 +501,6 @@ export interface WebviewMessage {
502501
| "deleteMessageConfirm"
503502
| "submitEditedMessage"
504503
| "editMessageConfirm"
505-
| "enableMcpServerCreation"
506504
| "remoteControlEnabled"
507505
| "taskSyncEnabled"
508506
| "searchCommits"
@@ -643,7 +641,7 @@ export interface WebviewMessage {
643641
modeConfig?: ModeConfig
644642
timeout?: number
645643
payload?: WebViewMessagePayload
646-
source?: "global" | "project"
644+
source?: "global" | "project" | "built-in"
647645
skillName?: string // For skill operations (createSkill, deleteSkill, openSkillFile)
648646
skillMode?: string // For skill operations (mode restriction)
649647
skillDescription?: string // For createSkill (skill description)
@@ -790,7 +788,6 @@ export interface ClineSayTool {
790788
| "codebaseSearch"
791789
| "readFile"
792790
| "readCommandOutput"
793-
| "fetchInstructions"
794791
| "listFilesTopLevel"
795792
| "listFilesRecursive"
796793
| "searchFiles"
@@ -801,6 +798,7 @@ export interface ClineSayTool {
801798
| "imageGenerated"
802799
| "runSlashCommand"
803800
| "updateTodoList"
801+
| "skill"
804802
path?: string
805803
// For readCommandOutput
806804
readStart?: number
@@ -847,6 +845,8 @@ export interface ClineSayTool {
847845
args?: string
848846
source?: string
849847
description?: string
848+
// Properties for skill tool
849+
skill?: string
850850
}
851851

852852
// Must keep in sync with system prompt.

src/core/assistant-message/NativeToolCallParser.ts

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -449,14 +449,6 @@ export class NativeToolCallParser {
449449
}
450450
break
451451

452-
case "fetch_instructions":
453-
if (partialArgs.task !== undefined) {
454-
nativeArgs = {
455-
task: partialArgs.task,
456-
}
457-
}
458-
break
459-
460452
case "generate_image":
461453
if (partialArgs.prompt !== undefined || partialArgs.path !== undefined) {
462454
nativeArgs = {
@@ -476,6 +468,15 @@ export class NativeToolCallParser {
476468
}
477469
break
478470

471+
case "skill":
472+
if (partialArgs.skill !== undefined) {
473+
nativeArgs = {
474+
skill: partialArgs.skill,
475+
args: partialArgs.args,
476+
}
477+
}
478+
break
479+
479480
case "search_files":
480481
if (partialArgs.path !== undefined || partialArgs.regex !== undefined) {
481482
nativeArgs = {
@@ -736,14 +737,6 @@ export class NativeToolCallParser {
736737
}
737738
break
738739

739-
case "fetch_instructions":
740-
if (args.task !== undefined) {
741-
nativeArgs = {
742-
task: args.task,
743-
} as NativeArgsFor<TName>
744-
}
745-
break
746-
747740
case "generate_image":
748741
if (args.prompt !== undefined && args.path !== undefined) {
749742
nativeArgs = {
@@ -763,6 +756,15 @@ export class NativeToolCallParser {
763756
}
764757
break
765758

759+
case "skill":
760+
if (args.skill !== undefined) {
761+
nativeArgs = {
762+
skill: args.skill,
763+
args: args.args,
764+
} as NativeArgsFor<TName>
765+
}
766+
break
767+
766768
case "search_files":
767769
if (args.path !== undefined && args.regex !== undefined) {
768770
nativeArgs = {

src/core/assistant-message/presentAssistantMessage.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import type { ToolParamName, ToolResponse, ToolUse, McpToolUse } from "../../sha
1414
import { AskIgnoredError } from "../task/AskIgnoredError"
1515
import { Task } from "../task/Task"
1616

17-
import { fetchInstructionsTool } from "../tools/FetchInstructionsTool"
1817
import { listFilesTool } from "../tools/ListFilesTool"
1918
import { readFileTool } from "../tools/ReadFileTool"
2019
import { readCommandOutputTool } from "../tools/ReadCommandOutputTool"
@@ -34,6 +33,7 @@ import { attemptCompletionTool, AttemptCompletionCallbacks } from "../tools/Atte
3433
import { newTaskTool } from "../tools/NewTaskTool"
3534
import { updateTodoListTool } from "../tools/UpdateTodoListTool"
3635
import { runSlashCommandTool } from "../tools/RunSlashCommandTool"
36+
import { skillTool } from "../tools/SkillTool"
3737
import { generateImageTool } from "../tools/GenerateImageTool"
3838
import { applyDiffTool as applyDiffToolClass } from "../tools/ApplyDiffTool"
3939
import { isValidToolName, validateToolUse } from "../tools/validateToolUse"
@@ -347,8 +347,6 @@ export async function presentAssistantMessage(cline: Task) {
347347
return readFileTool.getReadFileToolDescription(block.name, block.nativeArgs)
348348
}
349349
return readFileTool.getReadFileToolDescription(block.name, block.params)
350-
case "fetch_instructions":
351-
return `[${block.name} for '${block.params.task}']`
352350
case "write_to_file":
353351
return `[${block.name} for '${block.params.path}']`
354352
case "apply_diff":
@@ -394,6 +392,8 @@ export async function presentAssistantMessage(cline: Task) {
394392
}
395393
case "run_slash_command":
396394
return `[${block.name} for '${block.params.command}'${block.params.args ? ` with args: ${block.params.args}` : ""}]`
395+
case "skill":
396+
return `[${block.name} for '${block.params.skill}'${block.params.args ? ` with args: ${block.params.args}` : ""}]`
397397
case "generate_image":
398398
return `[${block.name} for '${block.params.path}']`
399399
default:
@@ -760,13 +760,6 @@ export async function presentAssistantMessage(cline: Task) {
760760
pushToolResult,
761761
})
762762
break
763-
case "fetch_instructions":
764-
await fetchInstructionsTool.handle(cline, block as ToolUse<"fetch_instructions">, {
765-
askApproval,
766-
handleError,
767-
pushToolResult,
768-
})
769-
break
770763
case "list_files":
771764
await listFilesTool.handle(cline, block as ToolUse<"list_files">, {
772765
askApproval,
@@ -870,6 +863,13 @@ export async function presentAssistantMessage(cline: Task) {
870863
pushToolResult,
871864
})
872865
break
866+
case "skill":
867+
await skillTool.handle(cline, block as ToolUse<"skill">, {
868+
askApproval,
869+
handleError,
870+
pushToolResult,
871+
})
872+
break
873873
case "generate_image":
874874
await checkpointSaveAndMark(cline)
875875
await generateImageTool.handle(cline, block as ToolUse<"generate_image">, {
@@ -1049,7 +1049,6 @@ function containsXmlToolMarkup(text: string): boolean {
10491049
"codebase_search",
10501050
"edit_file",
10511051
"execute_command",
1052-
"fetch_instructions",
10531052
"generate_image",
10541053
"list_files",
10551054
"new_task",

src/core/auto-approval/index.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,11 @@ export async function checkAutoApproval({
151151
return { decision: "approve" }
152152
}
153153

154-
if (tool?.tool === "fetchInstructions") {
155-
if (tool.content === "create_mode") {
156-
return state.alwaysAllowModeSwitch === true ? { decision: "approve" } : { decision: "ask" }
157-
}
158-
159-
if (tool.content === "create_mcp_server") {
160-
return state.alwaysAllowMcp === true ? { decision: "approve" } : { decision: "ask" }
161-
}
154+
// The skill tool only loads pre-defined instructions from built-in, global, or project skills.
155+
// It does not read arbitrary files - skills must be explicitly installed/defined by the user.
156+
// Auto-approval is intentional to provide a seamless experience when loading task instructions.
157+
if (tool.tool === "skill") {
158+
return { decision: "approve" }
162159
}
163160

164161
if (tool?.tool === "switchMode") {

src/core/prompts/__tests__/add-custom-instructions.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ describe("addCustomInstructions", () => {
211211
undefined, // customModes
212212
undefined, // globalCustomInstructions
213213
undefined, // experiments
214-
true, // enableMcpServerCreation
215214
undefined, // language
216215
undefined, // rooIgnoreInstructions
217216
undefined, // partialReadsEnabled
@@ -233,7 +232,6 @@ describe("addCustomInstructions", () => {
233232
undefined, // customModes
234233
undefined, // globalCustomInstructions
235234
undefined, // experiments
236-
true, // enableMcpServerCreation
237235
undefined, // language
238236
undefined, // rooIgnoreInstructions
239237
undefined, // partialReadsEnabled
@@ -257,7 +255,6 @@ describe("addCustomInstructions", () => {
257255
undefined, // customModes,
258256
undefined, // globalCustomInstructions
259257
undefined, // experiments
260-
false, // enableMcpServerCreation
261258
undefined, // language
262259
undefined, // rooIgnoreInstructions
263260
undefined, // partialReadsEnabled
@@ -280,7 +277,6 @@ describe("addCustomInstructions", () => {
280277
undefined, // customModes,
281278
undefined, // globalCustomInstructions
282279
undefined, // experiments
283-
true, // enableMcpServerCreation
284280
undefined, // language
285281
undefined, // rooIgnoreInstructions
286282
true, // partialReadsEnabled

0 commit comments

Comments
 (0)