perf(prompts): trim tool schema descriptions to reduce prompt token count
Removes verbose redundant text from tool descriptions and system prompt guidance: multi-line recurrence_rule JSON examples, CAPS warnings that duplicate system prompt instructions, and wordy descriptions that don't add model understanding. Saves ~990 tokens per request (~17% reduction, 5,639 → ~4,650 tokens), reducing prefill time on cache misses and lowering KV memory pressure. No functional changes — parameter names, types, enums, and required fields are unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -508,17 +508,10 @@ async def build_context(
|
||||
"next line. Never describe images as text or list their URLs — always render them as markdown images."
|
||||
)
|
||||
tool_lines.append(
|
||||
"Use update_note to edit/expand an existing note OR to update a task's status/priority/due_date. "
|
||||
"Use create_note ONLY for genuinely new notes with a different title. "
|
||||
"Use list_tasks to find tasks by status, priority, or due date (e.g. overdue, high priority, in progress). "
|
||||
"If a note was created earlier in the conversation and the user provides more content for it, use update_note. "
|
||||
"Use get_note to read the full content of a specific note. "
|
||||
"Use list_notes to browse notes by recency or tag. "
|
||||
"Use search_notes for conceptual/semantic queries — e.g. 'what notes do I have about X' or "
|
||||
"'find notes related to Y' — it uses semantic understanding to find thematically related content "
|
||||
"even when exact words don't match. Pass project= to scope the search to a specific project. "
|
||||
"Use delete_note / delete_task only when explicitly asked to delete — these require confirmation. "
|
||||
"Never proactively search notes or comment on the absence of notes/context unless the user explicitly asks about their notes."
|
||||
"Use update_note for existing notes/tasks; use create_note only for new content. "
|
||||
"Use search_notes for semantic/conceptual queries. "
|
||||
"Delete tools require an explicit user request. "
|
||||
"Never proactively search notes or comment on absent context."
|
||||
)
|
||||
tool_guidance = "\n".join(tool_lines)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user