From 35a3520621e98ddc187cd997a7933aea4edaeeb4 Mon Sep 17 00:00:00 2001 From: Edvard Date: Thu, 19 Feb 2026 16:23:41 -0500 Subject: [PATCH] fix(channel): remove duplicated tool protocol from system prompt build_system_prompt() included a "## Tool Use Protocol" section with the tag format and usage instructions. build_tool_instructions() then appended another identical "## Tool Use Protocol" section with full JSON schemas. This wasted ~1-2K tokens on every API call. Remove the duplicate protocol block from build_system_prompt(), keeping only the compact tool name/description list. The complete protocol with schemas is provided by build_tool_instructions(). Co-Authored-By: Claude Opus 4.6 --- src/channels/mod.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/channels/mod.rs b/src/channels/mod.rs index 8be603f..c90ea49 100644 --- a/src/channels/mod.rs +++ b/src/channels/mod.rs @@ -1239,13 +1239,7 @@ pub fn build_system_prompt( for (name, desc) in tools { let _ = writeln!(prompt, "- **{name}**: {desc}"); } - prompt.push_str("\n## Tool Use Protocol\n\n"); - prompt.push_str("To use a tool, wrap a JSON object in tags:\n\n"); - prompt.push_str("```\n\n{\"name\": \"tool_name\", \"arguments\": {\"param\": \"value\"}}\n\n```\n\n"); - prompt.push_str("You may use multiple tool calls in a single response. "); - prompt.push_str("After tool execution, results appear in tags. "); - prompt - .push_str("Continue reasoning with the results until you can give a final answer.\n\n"); + prompt.push('\n'); } // ── 1b. Hardware (when gpio/arduino tools present) ───────────