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 <noreply@anthropic.com>
This commit is contained in:
Edvard 2026-02-19 16:23:41 -05:00 committed by Chummy
parent 3a8a1754ef
commit 35a3520621

View file

@ -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 <tool_call></tool_call> tags:\n\n");
prompt.push_str("```\n<tool_call>\n{\"name\": \"tool_name\", \"arguments\": {\"param\": \"value\"}}\n</tool_call>\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 <tool_result> 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) ───────────