From 9bdbc1287cb091214e7d236b5c3307b939770d57 Mon Sep 17 00:00:00 2001 From: Argenis Date: Mon, 16 Feb 2026 02:36:21 -0500 Subject: [PATCH] fix: add tool use protocol to channel/daemon/gateway system prompts Fixes #284 - Tool call format was missing from the system prompt in channel, daemon, and gateway modes. This caused LLMs to not know how to properly invoke tools when using these modes. The tool use protocol with tags and JSON payload format now matches the implementation in agent loop mode. Co-Authored-By: Claude Opus 4.6 --- src/channels/mod.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/channels/mod.rs b/src/channels/mod.rs index 31a2b3f..936a26b 100644 --- a/src/channels/mod.rs +++ b/src/channels/mod.rs @@ -318,7 +318,12 @@ pub fn build_system_prompt( for (name, desc) in tools { let _ = writeln!(prompt, "- **{name}**: {desc}"); } - prompt.push('\n'); + 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"); } // ── 2. Safety ───────────────────────────────────────────────