From 8eea1d94ffedcfaea90f61f4b61b6b398b21f0af Mon Sep 17 00:00:00 2001 From: Tim Lingo Date: Tue, 9 Jun 2026 23:39:26 -0500 Subject: [PATCH] feat(chat): make web search built-in (always attach native web_search) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit handle_chat_agentic now always attaches Anthropic's native web_search_20250305 tool instead of gating it behind a per-request web_search flag. Web search is a built-in capability: the model invokes it only when a query needs fresh info (max_uses:5 caps it), so there is no user-facing toggle. The body's web_search field is now ignored (back-compat — old UI clients sending it cause no harm). Pairs with neuron-ui removing the chat-input web search toggle. Note: .el change only — no elc on the authoring machine; reviewer builds/verifies. Co-Authored-By: Claude Opus 4.8 --- chat.el | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/chat.el b/chat.el index 43dd9a5..e0cb7a1 100644 --- a/chat.el +++ b/chat.el @@ -259,13 +259,13 @@ fn agentic_tools_literal() -> String { "]" } -// agentic_tools_with_web — the standard tool set, plus Anthropic's NATIVE server-side -// web_search tool when web_search is requested. The native tool is executed by Anthropic -// (not by the soul), so it returns real results with citations and needs no local runtime -// — it sidesteps the soul's lack of executable tools entirely. -fn agentic_tools_with_web(web_search: Bool) -> String { +// agentic_tools_with_web — the standard tool set, always plus Anthropic's NATIVE +// server-side web_search tool. Web search is BUILT IN: the model invokes it only when a +// query needs fresh info (max_uses caps it), so there is no user-facing toggle. The native +// tool is executed by Anthropic (not by the soul), so it returns real results with citations +// and needs no local runtime — it sidesteps the soul's lack of executable tools entirely. +fn agentic_tools_with_web() -> String { let base: String = agentic_tools_literal() - if !web_search { return base } let inner: String = str_slice(base, 1, str_len(base) - 1) return "[" + inner + ",{\"type\":\"web_search_20250305\",\"name\":\"web_search\",\"max_uses\":5}]" } @@ -314,8 +314,7 @@ fn handle_chat_agentic(body: String) -> String { let system: String = identity + " You have access to tools: read files, write files, browse the web, search your memory, run commands. Use them when they add genuine value. Be direct.\n\n" + ctx let api_key: String = agentic_api_key() - let web_search: Bool = json_get_bool(body, "web_search") - let tools_json: String = agentic_tools_with_web(web_search) + let tools_json: String = agentic_tools_with_web() let safe_msg: String = json_safe(message) let safe_sys: String = json_safe(system) let messages: String = "[{\"role\":\"user\",\"content\":\"" + safe_msg + "\"}]"