diff --git a/src/plugin/tool-execute-before.ts b/src/plugin/tool-execute-before.ts index c7fefb0a6b..34f6a15c19 100644 --- a/src/plugin/tool-execute-before.ts +++ b/src/plugin/tool-execute-before.ts @@ -39,6 +39,13 @@ export function createToolExecuteBeforeHandler(args: { } } + // Coerce string booleans for edit tool (LLMs sometimes output "false"/"true" instead of false/true) + if (input.tool === "edit") { + if (typeof output.args.replaceAll === "string") { + output.args.replaceAll = output.args.replaceAll === "true" + } + } + if (hooks.ralphLoop && input.tool === "slashcommand") { const rawCommand = typeof output.args.command === "string" ? output.args.command : undefined const command = rawCommand?.replace(/^\//, "").toLowerCase()