feat(chat): ground factual claims in tool results, be honest when empty
Applies the grounding discipline from the agentic briefing work to the main chat system prompt. The regular chat pipeline was already agentic (it uses stream_chat_with_tools), but its system prompt never told the model "only assert facts from tool results" or "if a tool returns nothing, say so honestly." That left room for the same class of hallucinations the briefings had — calling list_events, getting an empty array, and then confidently mentioning a meeting anyway. Adds two new static rules to the tool guidance block in llm.build_context: GROUNDING — when the user asks about their own data, call the relevant tool to see what exists. Never assert from memory or assumption. HONESTY WHEN EMPTY — if a tool returns empty results, tell the user plainly. No fabricated example items, no invented meetings, no generic suggestions dressed up as real data. Both rules are in the static (KV-cache-stable) portion of the system prompt so they cost nothing on repeated requests for the same user. Carries the hallucination fix from the briefing work directly into every chat turn, not just chat that happens inside a briefing thread. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -522,6 +522,8 @@ async def build_context(
|
||||
tool_lines = [
|
||||
"You have access to tool functions. You MUST use them when the user asks you to create, add, find, schedule, or search for anything.",
|
||||
"CRITICAL: Call the tool functions directly. NEVER write out function calls as text or code. NEVER describe what you would do — just do it.",
|
||||
"GROUNDING: When the user asks about their own data — tasks, notes, events, projects, news, anything stored in this system — call the relevant tool to see what actually exists before answering. Never assert facts about the user's data from memory, prior context, or assumption. If you are unsure whether something exists, check with a tool.",
|
||||
"HONESTY WHEN EMPTY: If a tool returns empty results (no matching tasks, no events in the date range, no search hits, no notes found), tell the user plainly that nothing matched. Do not fabricate example items, do not invent plausible-sounding meetings or deadlines to fill the response, and do not hedge with generic suggestions dressed up as real data. A direct 'you don't have anything on your calendar today' is always better than an invented event.",
|
||||
"Available actions: create_task, create_note, update_note, delete_note, delete_task, get_note, list_notes, list_tasks, search_notes.",
|
||||
]
|
||||
if has_caldav:
|
||||
|
||||
Reference in New Issue
Block a user