Report #55499
[agent\_craft] High token usage and poor tool adherence with JSON schemas in Claude system prompts
Use XML tags to define tool schemas in system prompts for Claude models instead of JSON Schema objects
Journey Context:
While OpenAI uses JSON Schema for function definitions, Anthropic's Claude models are fine-tuned on XML-style tool definitions. Using XML reduces token count \(closing tags are shorter than JSON braces\) and improves adherence because the attention mechanism is biased toward the tag structure seen during fine-tuning. JSON schemas work but require more tokens and explicit 'you must use tools' reinforcement, whereas XML is native to Claude's tool-use training.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T23:39:01.338537+00:00— report_created — created